Network Setup Scripting Troubles
Network Setup Scripting Troubles
- Subject: Network Setup Scripting Troubles
- From: John Loch <email@hidden>
- Date: Thu, 25 Jan 2001 12:25:40 -0800
I recently upgraded to Mac OS 9.1 and my simple Internet connection
script (using PPP connect) no longer works. So I pulled the
following script from the Applescript Guidebook (available from
www.apple.com/applescript):
set the config_name to "My Company Remote Connection (Toll free)"
set the wait_amount to 180 -- length of time (in seconds) to monitor connection
set the delay_time to 10 -- length of time (in seconds) between status checks
set the num_queries to (the wait_amount div the delay_time)
set the transaction_ID to ""
try
tell application "Network Setup Scripting"
open database
set the transaction_ID to begin transaction
-- check for and activate the configuration
if (exists Remote Access configuration the config_name) then
set active of Remote Access configuration the config_name to true
else
error "This configuration does not exist: " & config_name
end if
end transaction
-- start the connection process
connect Remote Access configuration config_name
-- check the status
repeat num_queries times
set current_status to the status of Remote Access
configuration config_name
set the msg to the message of the current_status
say msg
if the activity of current_status is in {connected, idle} then
exit repeat
else
delay delay_time
end if
end repeat
close database
end tell
on error error_message
try
tell application "Network Setup Scripting"
if the transaction_ID is not "" then abort transaction
close database
end tell
on error
end try
tell application (path to frontmost application as text)
display dialog error_message buttons {"OK"} default button 1
end tell
end try
The problem I am having with this script is that it never returns the
status of the connection for the line:
set current_status to the status of Remote Access configuration config_name
I have been unsuccessful in attempting to access the status of a
Remote Access configuration. Has anyone figured this out?
- John Loch
email@hidden