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


Click here to return to the 'Without Bluetooth Solution: Send SMS from Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Without Bluetooth Solution: Send SMS from Address Book
Authored by: nshockey on Feb 16, '04 10:53:25AM
Here is a solution to send an SMS message to anyone's cell phone without using Bluetooth.
I created the following AppleScript and added it to the /Library/Address Book Plug-Ins/ folder of my Hard Drive.
After placing the script in the above folder, I launched "Address Book"
and now can send a SMS message (via the iChat SMS tip) to anyone by
clicking beside their cell phone number.

*Note: This requires OS 10.3 and that UI Scripting be activated via the
"Universal Access" pane of System Preferences. See Apple's page on how to
activate this:more detail



using terms from application "Address Book"
	
	on action property
		return "phone"
	end action property
	
	on action title for p with e
		return "Send SMS to " & name of p & "'s Cell Phone"
	end action title
	
	on should enable action for p with e
		if value of e is missing value then
			return false
		else
			return true
		end if
	end should enable action
	
	on perform action for p with e
		set thePhone to value of e
		
		--strip characters: - ( )  and spaces from the phone number
		set the message_text to thePhone
		set the message_text to replace_chars(message_text, " ", "")
		set the message_text to replace_chars(message_text, "(", "")
		set the message_text to replace_chars(message_text, ")", "")
		set the message_text to replace_chars(message_text, "-", "")
		set thePhone to the message_text
		
		--Make sure there is an area code
		if (the count of the characters of thePhone) < 10 then
			display dialog "This will fail if you do not have an area code for the cell phone.  You can manual add the area code after the '+1' and before the phone number (xxx-xxxx) in iChat. Click 'OK' to continue or 'Cancel' to quit this process."
		end if
		
		try
			tell application "iChat" to activate
			tell application "System Events"
				tell application process "iChat"
					tell menu item 2 of menu 3 of menu bar 1 to click
					keystroke "+1" & thePhone --format iChat needs to send SMS to cell phone
				end tell
			end tell
		end try
	end perform action
	
end using terms from

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


[ Reply to This | # ]