The Scripting Additions are working great when using the internal modem of my ibook - but how can I
tell them to use my external modem?
initModem "/dev/cu.modem" with "~^M~AT&F1E0S7=45S0=0L2^M"
set phone to "1234567"
display dialog "Dial phone: " default answer phone buttons {"Cancel", "OK"} default button 2
if the button returned of the result is "OK" then
dial modem "ATDT" & phone
display dialog "Dialling" & phone buttons {"OK} default button 1
end if
hang up
this works great - now with my external modem:
initModem "/dev/cu.HUAWEIMobile-Modem" with "AT&FE0V1S0=0\13"
If you have two modems attached to your machine, the one at the top of the System Preferences > Network > Network Port Configurations rules. Is your external modem at the top of that list?
yep it is there - but I want to connect via Applescript instead of Internet Connect,
because with InternetConnect I am not able to change the name of the interface
or the modem script! Thats why I try to work with the scripting addition to connect
directly to the modem and send the init string from the application…
set phone_num to "1234567"
do shell script "screen -d -m -S phone /dev/cu.HUAWEIMobile-Modem"
do shell script "screen -S phone -p 0 -X eval 'stuff \"AT&FE0V1S0=0" & "\\015\"'"
delay 1
display dialog "Dial phone: " default answer phone_num buttons {"Cancel", "OK"} default button 1
copy the result as list to {text_returned, button_pressed}
if button_pressed is "OK" then
do shell script "screen -S phone -p 0 -X eval 'stuff \"atdt" & phone_num & "\\015\"'"
display dialog "Dialling : " & text_returned buttons {"OK"} default button 1
if the button returned of the result is "OK" then
-- hang up modem
do shell script "screen -S phone -p 0 -X eval 'stuff \"ath0\\015\"'"
-- and close session
do shell script "screen -S phone -p 0 -X kill"
end if
end if
Now I’m getting interested, Mark. This fails on MM although I have the osax and an external modem. The failure point is
do shell script "screen -d -m -S phone /dev/cu.HUAWEIMobile-Modem"
with the message: no screen session found, so obviously I was meant to set something up before I ran this. I’ve never used screen and its man pages are a mile long. What’s next? (Mind you, I use Jon’s Phone Tool to do all this, and it works).
Yup. I got it here in ScriptBuilders: Jon’s Phone Tool. Jon’s web page is here: http://homepage.mac.com/jonn8/jpt/. Costs $15 (Shareware). It integrates with the Address Book very nicely, dials your phone and then after a pause hangs up - you have by then picked up.