Re: Internet Connect Script
Re: Internet Connect Script
- Subject: Re: Internet Connect Script
- From: Joseph Weaks <email@hidden>
- Date: Sat, 8 May 2004 18:54:22 -0500
I've only ever scripted the default config, so don't know. I wrote a
script to connect, get my mail, and then disconnect. It checks for
seconds connected instead of state. Can't you first set the default
config?
Well, seeing my script may not be helpful, but may spark something:
-- check to see if connection is already present
tell application "Internet Connect" to set statusCheck to seconds
connected of status
-- returns -2.147483648E+9 if not connected
if statusCheck is less than 1 then
tell application "Internet Connect" to connect
set temporaryConnection to true
-- Repeats until connected for at least 5 seconds
repeat while (statusCheck < 5)
tell application "Internet Connect" to set statusCheck to seconds
connected of status
delay 5
end repeat
else
set temporaryConnection to false
end if
-- check mail
tell application "Mail" to check for new mail
-- if this script initiated the connection then
--wait until connection is idle and then disconnect
if temporaryConnection then
tell application "Internet Connect"
set aaa to bytes received of status
set bbb to aaa + 5001
-- repeats until less than 5000 bytes have been downloaded in the
past 5 seconds (ie. connection is idle)
repeat while ((bbb - aaa) > 5000)
set aaa to bbb
delay 5
set bbb to bytes received of status
end repeat
disconnect
end tell
end if
Cheers,
Joe
On May 8, 2004, at 6:18 PM, Jim Lindholm wrote:
I have a script that has worked fine until I started using AirPort
regularly and as long as the Connection selected in Internet Connect
says "SaberNet (SF)", it still works fine. Problem is... if Connection
in Internet Connect is any of the other choices ie: "AirPort" (which is
set up for wireless connection) or "SaberNet (Sacto)", even tho I have
told Internet Connect to use the "SaberNet (SF)" Connection, it appears
to ignore this and tries to connect with the one that is selected in
Internet Connect. Since all but the "AirPort" Connection are PPP
setting, generally a connection is made. If "AirPort" happens to be
Configuration, then the script an AS -1718 error (Reply has not yet
arrived).
Basically... Configurations are not switching within Internet Connect.
Anyone see anything wrong with the script or have any suggestions on
what is needed to make ti work properly. Thanks... Jim
--INTERNET CONNECTION
tell application "Internet Connect"
get state of status of PPP configuration "SaberNet (SF)" --check
status of default connection
if (result = 4) then --connected
disconnect PPP configuration "SaberNet (SF)"
else
-- try
with timeout of 45 seconds --try to connect for 45 seconds, otherwise
exit with error
connect PPP configuration "SaberNet (SF)"
repeat until (result !A 0)
get state of status of PPP configuration "SaberNet (SF)" --check
status of default connection
if (result = 4) then
exit repeat
end if
delay 1
end repeat
end timeout
end if
end tell
_______________________________________________
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.
_______________________________________________
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.