Re: Scripting RA in OS 9.2
Re: Scripting RA in OS 9.2
- Subject: Re: Scripting RA in OS 9.2
- From: Jim Good <email@hidden>
- Date: Tue, 16 Oct 2001 22:39:06 -0500
Corny,
Thanks. I like your way better than what I was trying to do. The
connect/disconnect script is a great idea.
Jim
At 1:44 PM -0500 10/16/01, Jim Good wrote:
As of OS 9.1 (I'm using 9.2) you can't script Remote Access. Instead,
you script Network Setup Scripting (in the Scripting Additions
folder) to control Remote Access. But I've run into a problem. I
downloaded two scripts from Apple, one to connect via RA and one to
disconnect. However, I also want it to be able to select one of two
RA configurations (Earthlink and my Rice U configuration). The script
I downloaded is supposed to do just that (see below), but it's not
working. It just connects via whatever happens to be the currently
active RA configuration. Can someone tell me how to make this work?
Here is the script I use to change configs.
tell application "Network Setup Scripting"
try
close database
end try
try
open database
begin transaction
set active of TCPIP v4 configuration "Earthlink" to true
set active of Remote Access configuration "Earthlink" to true
end transaction
close database
on error
abort transaction
close database
end try
end tell
And this one to open or close a connection.
(*Toggle OT/PPP for 9.2.1:
If you have a simple dialup connection, this script will open PPP if
it is closed and close PPP if it is open. Compile it as an Applet.
Works with OS 9.2.1.*)
tell application "Network Setup Scripting"
try
close database
end try
try
open database
begin transaction
name of every Remote Access configuration whose active is true
set thisConfig to result as string
end transaction
set curStat to the status of Remote Access configuration thisConfig
set msg to message of curStat
if msg is "Idle." then
connect Remote Access configuration thisConfig
else
disconnect Remote Access configuration thisConfig
end if
close database
on error
try
end transaction
end try
try
close database
end try
end try
quit
end tell
HTH
Corny