Re: Remote Access and Network Setup Scripting problems under OS 9.1 (and 9.2.1)
Re: Remote Access and Network Setup Scripting problems under OS 9.1 (and 9.2.1)
- Subject: Re: Remote Access and Network Setup Scripting problems under OS 9.1 (and 9.2.1)
- From: Kai <email@hidden>
- Date: Wed, 12 Feb 2003 04:56:28 +0000
on Tue, 11 Feb 2003 13:27:45 +0000, Simon Brown <email@hidden>
wrote:
>
Oh well, perhaps someone else on the list could enlighten me on the 'raw'
>
constant values.
(I assume that, when you posted this, you may not have seen my message of
Tue, 11 Feb 2003 12:06:32 +0000.)
>
I'm running for 24 hours straight now on most occasions, so at least what I've
>
got is a definite improvement on the OSAX workaround. The problem now tends to
>
occur when restarting the script app without re-booting the machine. (DOGGEREL
>
ALERT) Even then, a call to NSS that just gets the un-interpreted value of the
>
activity constant usually seems to clear the problem (END DOGGEREL ALERT)
The fact that your script is returning raw codes suggests that, for some
strange reason, NSS isn't present to interpret them. Even if this were the
case, the 'tell' command should launch NSS before going ahead with the rest
of the script. All the same, it might be worth inserting (at the start of
your script) something like this - just in case it might help:
====================================
set nss to "Network Setup Scripting"
tell application "Finder" to set OK to nss is in processes's name
if not OK then
launch application nss
tell application "Finder" to repeat until nss is in processes's name
end repeat
end if
====================================
However, I'm still puzzled by the script handler that you posted:
>
on Get_RA_State()
>
-- returns state, seconds connected, connection speed
>
-- e.g. {connected, 620, 48000}
>
-- or {idle, 0, 0}
>
try
>
tell application "Network Setup Scripting"
>
-- open the Networking Database
>
open database
>
-- get the name of the active configuration (as a one item list)
>
set RA_ActiveConfig to every Remote Access configuration whose
>
active is true
>
set RA_ActiveConfig to item 1 of RA_ActiveConfig
>
set RA_ActiveConfigName to the name of Remote Access
>
configuration RA_ActiveConfig
>
set current_RA_Status to (the Remote Access status of Remote
>
Access configuration RA_ActiveConfig)
>
set RA_State to the activity of current_RA_Status
>
set RA_TimeConnected to the time connected of current_RA_Status
>
set RA_ConnectSpeed to (the first word of speed of
>
current_RA_Status) as integer
>
close database
>
end tell
>
on error errMsg number errNum
>
display dialog errMsg & return & return & errNum
>
try
>
tell application "Network Setup Scripting"
>
close database
>
end tell
>
end try
>
return {"Error", 0, 0}
>
end try
>
return {RA_State as string, RA_TimeConnected, RA_ConnectSpeed}
>
end Get_RA_State
OMM, this errors every time:
--> {"Error", 0, 0}
I also tried this on a machine running OS 9.1 - to which I made these
specific modifications:
=============================
-----------------------------
changed from v4.0 to v4.0.2
-----------------------------
Remote Access
OpenTpt Remote Access
DialAssist
OpenTpt Serial Arbitrator
Modem
-----------------------------
changed from v 1.2 to v 1.3.1
-----------------------------
Network Setup Scripting
Network Setup Extension
=============================
Again, the script errors every time:
--> {"Error", 0, 0}
I then tried the following script - which does work OMMs:
==========================================
tell application "Network Setup Scripting"
try
close database
end try
try
open database
set c to Remote Access configurations whose active is true
set s to c's item 1's status
set {a, t, s} to s's {activity, time connected, speed}
close database
on error
try
close database
end try
end try
end tell
{a as string, t, s's word 1 as number}
==========================================
--> {"idle", 0, 48000}
(An extra try block has been added at the beginning - just in case the
database is ever left open.)
Note that the connection speed here doesn't zero when status activity is
idle - as your script/system apparently does.
--
Kai
_______________________________________________
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.