Re: [newby] Detect if a script was started from the command line
Re: [newby] Detect if a script was started from the command line
- Subject: Re: [newby] Detect if a script was started from the command line
- From: patrick machielse <email@hidden>
- Date: Thu, 25 Aug 2005 16:43:24 +0200
Op 25-aug-2005, om 16:04 heeft applescript-users-
email@hidden het volgende geschreven:
On Aug 24, 2005, at 10:01 AM, patrick machielse wrote:
Also, if I run from the Script Editor I see that the class of
arguments is 'script'. How should I interpret that?
It means that "arguments" is a script object. As it happens, it's
the top-level script object, the same thing as "me" in that context.
So (at least on Tiger) I could test like this:
on run argv
if argv = me then
-- not started from the command line
Somehow that scares me...
As it happens I only need to branch in my script if an argument was
passed on the command line, so I think I can get away with testing
like so:
on run argv
if (class of argv = list) and ((count of argv) > 0) then
-- use the argument
else
-- use 'try' around gui code and catch errors
2. There are other ways for your script to be run without
interaction
allowed; running from osascript is merely the most common one.
I'm interested to know any other scenario's (executing over a
network connection?)
I'll admit that this is more a theoretical case than an actual one.
An application can request to not have any user interaction when
running a script, or it could implicitly be forced to do that because
it's background-only, but almost no one does that -- osascript is one
of the only cases.
If I understand you correctly: If I have an application that sets
LSUIElement 1 in its Info.plist, display dialog will fail if it tries
to execute that in an AppleScript file? Nice.
patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden