I’m having trouble getting RA to give me status. Here’s the script I’m using. It connects to the net just fine, but won’t give me status feedback. Please help, thx.
set the config_name to "Whatever your config is called" --Replace with your config's name try
tell application "Network Setup Scripting"
-- open the Networking Database
open database
-- check on the RA config
say "here goes" using "Princess"
Remote Access configuration config_name
say config_name
say "is now opened"
--Why doesn't the following work? It's always timing out... or ends without moving into the IF loop
set current_status to the status of Remote Access configuration config_name
if the activity of current_status is in ¬
{connected, idle} then
--This is where I would launch the web browser and point it to a specific page
say "Wow! It worked" using "Zarvox"
else
say "Poopies" using "Ralph"
end if
--close the Network Database
close database
end tell
on error
try
-- close the database if it was left open
tell application "Network Setup Scripting" to close database
end try
end try
: I’m having trouble getting RA to give me status.
Which version of AppleScript are you running? RA status was broken
somewhere along the way.
Later,
Rob J
: Which version of AppleScript are you running? RA status was broken somewhere
: along the way.
: Later,
: Rob J
Version 1.6
I uninstalled 9.2.1 because it the update in the sound libraries freaked out my iSub. I haven’t tried 9.2.2 yet to see if that was fixed, but I know that 9.2 has AppleScript 1.7, right?
Bug
I’m not sure this will be helpful to you but, using AS 1.3.7 / OS 8.6, I do NOT use Network Setup Scripting. I rely on the osax Remote Access Commands for constructs like the following, which I use every day without problem…
if ((RA status)'s state) = “connected” then exit repeat
if ((RA status)'s message)'s word 3 > 44000 then… Andreas
: Version 1.6
: I uninstalled 9.2.1 because it the update in the sound libraries freaked out
: my iSub. I haven’t tried 9.2.2 yet to see if that was fixed, but I know
: that 9.2 has AppleScript 1.7, right?
Sounds correct to me. Does this work for you? I don’t use RA, so I can’t do much testing.
– Begin Script –
tell application “Network Setup Scripting”
try
open database
set raStatus to activity of (get status of Remote Access configuration 1)
close database
on error
close database
end try
end tell
raStatus
– End Script –
– Rob J
Ah! I didn’t know that, Bug - I was rather wondering why you didn’t solve your problem with something so simple. Thank you for responding and telling me. Andreas
: Sounds correct to me. Does this work for you? I don’t use RA, so I can’t do
: much testing.
: – Begin Script –
: tell application “Network Setup Scripting” try open database set
: raStatus to activity of (get status of Remote Access configuration 1)
: close database on error close database end try end tell raStatus
: – End Script –
: – Rob J
Rob,
I’ve tried the above script but it gives me two errors. One, it told me the variable “raStatus” wasn’t defined. I fixed that by sticking a [code:1:000]set raStatus to be “”[/code:1:000] at the top of the script, but why didn’t your code set the variable for the script? It should have worked the way you typed it, right? I thought AS was cool with variables that way…
The second problem is that the script simply hangs while it tries to check the status of the config. I’m not sure what’s happening. It times out then tells me that Network Setup can’t close an item that isn’t open. Any suggestions?
: I’m not sure this will be helpful to you but, using AS 1.3.7 / OS 8.6, I do
: NOT use Network Setup Scripting. I rely on the osax Remote Access Commands
: for constructs like the following, which I use every day without problemÉ
: if (( RA status )'s state ) = “connected”
: then exit repeat
: if (( RA status )'s message )'s word 3 > 44000
: then… Andreas
RA osax is broken in 9.1 and above. I wonder when they’ll fix that part of AS?
: Rob,
: I’ve tried the above script but it gives me two errors. One, it told me the
: variable “raStatus” wasn’t defined. I fixed that by sticking a
: [code:1:000]set raStatus to be “”[/code:1:000] at the top of the script, but
: why didn’t your code set the variable for the script? It should have
: worked the way you typed it, right? I thought AS was cool with variables
: that way…
On this particular script, I wasn’t required to initialize the variable and I’m
not sure what conditions make it necessary when it does crop up.
: The second problem is that the script simply hangs while it tries to check
: the status of the config. I’m not sure what’s happening. It times out
: then tells me that Network Setup can’t close an item that isn’t open. Any
: suggestions?
I just ran the script again and it works here, returning a result of
“unknown” because Remote Access is not in use. I’m working with OS 9.1
and AppleScript 1.6. I don’t know what the problem is unless we are
working with different versions of OS/AS and something has changed.
Apple is working on the next version of AppleScript (I think it’s currently
1.8b.x) so hopefully the released version will squash some of these bugs.