Modem Init - AppleScript Addions

Hi Folks,

http://homepage.mac.com/javier_diaz_r/

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"

Has anyone an idea on how to solve this issue?

Thanks and best regards,

Stefan

You haven’t told us what the issue to be solved is, bosstone. I assume it doesn’t work. What does happen?

Hi Adam,

sorry, I forgot to tell the behavier…

It is still doing nothing - I am not able to check what it is doing…

The Error must be while initialising the Modem, but I am not able do figure out where…

Thanks and best regards,

Stefan

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?

Hi Adam,

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…

Best Regards,

Stefan

I assume you’re using the DialWithModem.osax, but confess I can’t get it to work with my external modem either. Sorry.

This may work

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

Hi Adam,

this is correct - it looks great, but simply will not work…

Dear Mark,

thanks for your effort - I will try and let you know as soon as possible…

thanks for your help!

Best regards,

Stefan

Dear Mark,

thanks again for your help, but it is not working - and I don´t know why:


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\"'"

I tried the first line in terminal with no result - there is no error message - there is simply nothing…
should there be any output?

Thanks again and best regards,

Stefan

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).

You need to set the screen -d -m -S phone /dev/cu.HUAWEIMobile-Modem

to
screen -d -m -S phone /dev/cu.YOURModemNAME-Modem

in terminal :
ls /dev/

You will see all your modem ports.

stefan.

the screen is detached so the is no window for it, in this case.

Try omitting the -d

You can also look at the man page screen

Hi Adam,

could you please post the Jons Phone Tools (are they scriptable) - I will give it a try…

Thanks for the new hints…

Best Regards,

Stefan

Do you get any errors

Hi Mark,

sorry - there are no errors… Simply nothing…

Best regards and thanks for your continous help…

Stefan

Hi Adam,

is it this tool?

http://www.apple.com/downloads/macosx/productivity_tools/jonsphonetool.html

Best regards,

Stefan

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.