using terms from application "Address Book" on action property return "phone" end action property on action title for p with e return "Dial using LandLine" 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 phone_num to the value of e -- 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, " ", "") -- See if number already starts with '+' if phone_num starts with "+" then -- If not, prepend "0" to the number and remove the +44 set phone_num to "0" & characters 4 thru -1 of phone_num end if land_out(phone_num) end perform action end using terms from on land_out(phone_num) tell application "Internet Connect" connect configuration "Internal Modem" to telephone number phone_num tell application "System Events" to set visible of application process "Internet Connect" to false tell application "Finder" display dialog "When you Hear Dialing choose" buttons {"Disconnect", "Pick-Up Handset"} default button 2 if the button returned of the result is "Disconect" then tell application "Internet Connect" disconnect end tell else tell application "Internet Connect" delay 2 -- appx time it takes to pick up phone after hitting pick up button disconnect end tell end if end tell get properties of current configuration end tell end land_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