Forum Index -> VoiceMac -> AddressBook Script to call or SMS using VoiceMac
Delete Thread
Page First 1 Last

J. Jordan
March 12, 2011, 11:56:38 PM
Made this a new thread because it was not really what the initiator of the previous thread was talking about.

After beating my head against the desk for two days, I seem to have this working. The script allows you click on a phone number in Address Book and select "Call or SMS with VoiceMac" It opens a very nice VoiceMac dialog which allows you to choose the account and Call, SMS or Cancel.

--VoieMac Dial or SMS
--Parts(most) of script taken from Adium's AdiumAddressBookAction_SMS.scrpt
--Adium is open source relased under the GNU GPL
--This script is released under the GNU GPL version 2

on cleanString(str, chars)
set tid to AppleScript's text item delimiters
repeat with c in chars
set AppleScript's text item delimiters to {c}
set chunks to text items of str
set AppleScript's text item delimiters to ""
set str to chunks as Unicode text
end repeat
set AppleScript's text item delimiters to tid
return str
end cleanString

using terms from application "Address Book"
on action property
return "phone"
end action property

on action title for aPerson with phoneNumber
return "Call or SMS with VoiceMac "
end action title

on should enable action for aPerson with phoneNumber
return true
end should enable action

on perform action for aPerson with phoneNumber
(* remove ignored phone characters *)
set phoneNumber to my cleanString(value of phoneNumber as string, {" ", "-", ")", "(", "."})

if (phoneNumber does not start with "1") and (phoneNumber does not start with "+") then
(* If the phone number neither starts with "1" nor with "+", add "+1" to it *)
set phoneNumber to "+1" & phoneNumber
else if (phoneNumber does not start with "+") then
(* If the phone number does not start with "+", add "+" to it *)
set phoneNumber to "+" & phoneNumber
end if
set phoneNumber to "tel:" & phoneNumber
tell application "VoiceMac" to open location phoneNumber
return true
activate
end perform action
end using terms from

To use: Paste code above into AppleScript Editor and save to ~/Library/Addess Book Plug-Ins as a script. I called it VoiceMac call.scpt but you can call it whatever you want.

Improvements: I did this purely through monkey-programming (monkey see, monkey do) I am sure it can be improved. It would be very nice if I could specify SIP, Google Voice dial-back, or SMS but could not figure out a way to do it.

-j

Mr. Gecko
March 13, 2011, 12:20:43 AM
I can add that stuff into the url, like say &ring=17474549979 for calling my Gizmo5 account back (I'm sad now...)

J. Jordan
March 13, 2011, 12:29:25 AM
Would that work dialing with a SIP account, I don't normally use the dial-back method of placing calls, I just dial straight through my SIP account.

Hope Google eventually opens the API so we can dial through google voice directly.

-j

Mr. Gecko
March 13, 2011, 12:38:53 AM
I do not have it in now, but if you mention what it has to do and how you want to use it, I can add it in later.

Page First 1 Last
Name:
Email Address:
Message:
Image Verification:
verify
Refresh