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: Simon Brown <email@hidden>
- Date: Thu, 13 Feb 2003 00:04:48 +0000
Kai Wrote:
>
>
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}
Say what? Now I'm very confused. I've copied & recompiled the script above
on my machine and it works (as does your far more concise example). I've
also compared it (using Smile) to the current version of the handler that
I'm using in the script app. Interestingly, but probably not significantly
Smile detected white-space differences between the two until they'd been
saved, but other than that they're identical and both work on my machine
(see below for an exception though).
I'm running Mac OS Z1-9.1 (The international version) - don't know if that
could affect it? I've installed the same bits of 9.2 as you did for your
test with the exception of dial assist (which I don't use) and modem (which
I didn't think of changing).
If the handler was returning error it must have been going thru the on error
bit of the try statement - didn't you get an error message dialog? Maybe I
should have put tell(path to frontmost app as text) in front of it?
>
Note that the connection speed here doesn't zero when status activity is
>
idle - as your script/system apparently does.
BTW, the connection speed on my machine doesn't usually zero, but it
returns an empty string prior to the first connection after restart. I'm not
sure if anything else such as software conflict or could cause NSS to crash
without me noticing and so lose the data for the connection speed of the
most recent connection. I'm going to do some more tests and will post to the
list when I've got a bit further. The empty string does cause an error when
asked for its first word as integer, so one change I've made since posting
the handler is to test for that and only do data type coercions outside the
Tell NSS block.
Thank you very much for taking the time to make OS-level changes to test my
handler. I am very surprised and concerned that it errored every time for
you as I am hoping that what I'm working on will be of use to other people
as well as myself when finished.
I'll probably be going quiet for a while now while I work through what I've
learned from you and others on the list (and pull all the archive stuff I
can find on the subject). I will post my whole script a bit further down the
line when it's a bit more user friendly.
One problem I have now is that it's getting harder and harder to replicate
the errors so I have less chances to test them :)
Best regards
Simon Brown
_______________________________________________
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.