Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An improved Skype - Address Book script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An improved Skype - Address Book script
Authored by: mark hunte on Jul 20, '06 03:21:21PM
By: tj2001 on Thu, Jul 20 '06 at 12:26PM PDT Now I'm not a super Apple Scriptor though I do like some of the new actions you implemented. My only query is that what if you live in the US and need the +1 instead of the +44?
Simple. Here is the New Script.

Change your code in this part of the script property your_code : "+44" --set to you own country code.


property your_code : "+44" --set to you own country code.
using terms from application "Address Book"
	on action property
		return "phone"
	end action property
	
	on action title for p with e
		
		if label of e is equal to "Skype" then
			return "Call Skype Name"
		else
			return "Dial using Skype"
		end if
	end action title
	
	on should enable action for p with e
		return true
	end should enable action
	
	on perform action for p with e
		set _alphabet to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "Â
		q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "Â
		K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "+"}
		set phone_num to the value of e
		
		set phoneC to character 1 of phone_num as string
		
		if phoneC is not in _alphabet then
			
			set phone_num to your_code & characters 2 thru -1 of phone_num --addplus(phone_num, _alphabet)
			
		else
			
		end if
		
		
		-- Clean up the number from any extraneous characters
		-- like blanks, '(', ')', '-' .
		set phone_num to replace_chars(phone_num, "-", "")
		set phone_num to replace_chars(phone_num, "(", "")
		set phone_num to replace_chars(phone_num, ")", "")
		set phone_num to replace_chars(phone_num, " ", "")
		skype_out(phone_num)
		
	end perform action
	
	on addplus(phone_num, _alphabet)
		--if phone_num does not start with "+" then
		set phone_num to "+44" & characters 2 thru -1 of phone_num
		
		--end if
	end addplus
	
end using terms from

on skype_out(phone_num)
	tell application "Skype"
		activate
		set call_string to "callto:" & phone_num
		get URL call_string
	end tell
end skype_out

-- Text replace function
on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

---
mh

[ Reply to This | # ]