Re: Phone dialing via modem
Re: Phone dialing via modem
- Subject: Re: Phone dialing via modem
- From: Irwin Poche <email@hidden>
- Date: Sun, 23 May 2004 08:43:20 -0500
>
> There's been a few threads about having AS dial phone numbers using
>
> the modem. I have found a OSAX to do so that works well and also
>
> includes a script to attach itself to the phone number labels in
>
> Address Book.
>
>
>
> It's at <http://homepage.mac.com/javier_diaz_r/eng/resources.html>
>
>
I made small change to the script to deal with our local 10 digit
>
numbers and now it won't work. It doesn't appear in the Address book
>
button there some magic incantation I need to be aware of?
>
>
Tia,
>
--
>
Bob Poland - Englewood, CO
>
http://www.ibrb.org/
Check the console log. Errors show up there. I don't know if that's
because of how AB invokes the script or if all AS errors are logged.
I also always have to dial my area code(s) and modified the script for
that and other stuff too. Watch out for line wrapping...
(* Requires DialModemOSAX from Javier Dmaz Reinoso
http://homepage.mac.com/javier_diaz_r/
Javier Diaz-Reinoso <email@hidden>
*)
(* Changed for 10 digit dialing, toll-free, special phone services,
calling card long distance, and alpha to numeric conversion *)
property toll_free : {"800", "866", "877", "888", "700"}
property local_area_codes : {"713", "218", "832"}
property calling_card_number : "1-800-569-6972,,,"
property calling_card_access_code : "228900520864,,,"
property special_services : {"#", "*"}
on prefixed_num(num)
set c13 to ((characters 1 thru 3 of num) as string)
repeat with x from 1 to count special_services
if item x of special_services is in num then
return num
end if
end repeat
if c13 is in local_area_codes then
return num
else if c13 is in toll_free then
return "1-" & num
else
return calling_card_number & calling_card_access_code & num
end if
end prefixed_num
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for aPerson with aPhone
set thephonenum to (value of aPhone) as string
set thephonenum to prefixed_num(thephonenum)
return "Dial " & thephonenum & " with Modem"
end action title
on should enable action for aPerson with aPhone
return true
end should enable action
on perform action for aPerson with aPhone
--say "start"
initModem "/dev/cu.modem" with "~^M~AT&F1E0S7=45S0=0L2^M"
delay 1
set thephonenum to (value of aPhone) as string
set thephonenum to prefixed_num(thephonenum)
set thephonenum to substitute_digits(thephonenum)
dial modem "ATDT" & thephonenum
display dialog "Dialing " & (name of aPerson) & "'s " & (label of
aPhone) & " number " & return & (thephonenum) ,
buttons {"Hang up"} default button 1
hang up
end perform action
end using terms from
on substitute_digits(num)
set new_num to ""
repeat with x in num
if x is in {"A", "B", "C", "a", "b", "c"} then
set y to "2"
else if x is in {"D", "E", "F", "d", "e", "f"} then
set y to "3"
else if x is in {"G", "H", "I", "g", "h", "i"} then
set y to "4"
else if x is in {"J", "K", "L", "j", "k", "l"} then
set y to "5"
else if x is in {"M", "N", "O", "m", "n", "o"} then
set y to "6"
else if x is in {"P", "Q", "R", "S", "p", "q", "r", "s"} then
set y to "7"
else if x is in {"T", "U", "V", "t", "u", "v"} then
set y to "8"
else if x is in {"W", "X", "Y", "Z", "w", "x", "y", "z"} then
set y to "9"
else
set y to x
end if
set new_num to new_num & y
end repeat
return new_num
end substitute_digits
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.