• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Remote Access and Network Setup Scripting problems under OS 9.1 (and 9.2.1)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Thu, 13 Feb 2003 20:39:10 +0000

on Thu, 13 Feb 2003 00:04:48 +0000, Simon Brown wrote:

> Kai Wrote:
>>
>> However, I'm still puzzled by the script handler that you posted:

[snip: script handler]

>> OMM, this errors every time:
>> --> {"Error", 0, 0}
>
> Say what? Now I'm very confused.

Sorry Simon - that was the last thing I intended. :-)

> 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).

Mac OS Z1-9.1 is also the system I used. I updated the items mentioned as a
precaution, since they all belong to the same package (Apple Remote Access).

> 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?

Sorry - I should have been more explicit. When I run the script, it does
enter the error trap and display a message. However, what the handler
eventually returns, {"Error", 0, 0}, is nevertheless the result of an error.

>> 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.

Yeah - actually I get the same here, too. I've tweaked my suggestion to
handle this post-restart/pre-connection behaviour - as well as to insert a
more general error handler:

================================================

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, b} to s's {activity, time connected, speed}
close database
on error e number n
try
close database
end try
beep
tell current application to display dialog e & return & [NO-BREAK]
n buttons {"Cancel", "Continue..."} default button 2 with icon 2
return {"Error", 0, 0}
end try
end tell
{a as string, t, (b & " 0")'s word 1 as integer}

================================================

(Note that the 'close database' command is placed before the error dialog -
so that, if the user cancels, the database is not left open.)

> 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've now commented your original script to indicate where it errors OMM -
and why. However, since its inclusion here is likely to bloat the size of
this message beyond what the server 'bot considers acceptable, I'll post it
separately.

> 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 :)

Ah yes - the old 'good news/bad news' syndrome. ;-)

Let me know if you'd like to hammer this out further off-list, Simon. I'd be
happy to compare notes with you on the subject.

Best wishes.

--
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.

  • Prev by Date: Re: MacOS X simple script error
  • Next by Date: Re: Remote Access and Network Setup Scripting problems under OS 9.1 (and 9.2.1)
  • Previous by thread: Re: Scripting with 'Internet Explorer'
  • Next by thread: Re: Remote Access and Network Setup Scripting problems under OS 9.1 (and 9.2.1)
  • Index(es):
    • Date
    • Thread