Re: Network Setup Scripting Troubles
Re: Network Setup Scripting Troubles
- Subject: Re: Network Setup Scripting Troubles
- From: Tod Hallberg <email@hidden>
- Date: Fri, 26 Jan 2001 10:31:48 -0500
- Organization: Monical Pizza Corporation
Well here is what I have been trying in 9.0.4 without the Remote Access Commands
OSAX installed.:
--BEGIN COPY
tell application "Network Setup Scripting"
open database
get status of Remote Access Configuration "Blah"
set RAcurrentStatus to activity of result --I can't get it to work
reliably if I set it directly
if RAcurrentStatus *idle then -- "*" is a "not equal to" mark if the list
server chews it up
try
close database
on error
end try
tell me
activate
display dialog "Sorry, I'm busy. Try later." buttons {"Cancel"}
default buttons {"Cancel"}
end tell
end if
-- return RAcurrentStatus
--END COPY
try that. let me know how it works.
tod
John Loch wrote:
>
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
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users