global thePID 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) ignoring application responses tell application "Finder" set thecall to do shell script "efax -v0 -d /dev/cu.modem -a TDT" & phone_num end tell end ignoring set thePID to do shell script "ps acx |grep -i efax | awk {'print $1'}" as string display dialog "When you Hear Dialing choose" buttons {"Disconnect", "Pick-Up Handset"} default button 2 if the button returned of the result is "Disconnect" then do shell script "kill " & thePID else delay 2 -- appx time it takes to pick up phone after hitting pick up button do shell script "kill " & thePID end if end land_out 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