[newby] Detect if a script was started from the command line
[newby] Detect if a script was started from the command line
- Subject: [newby] Detect if a script was started from the command line
- From: patrick machielse <email@hidden>
- Date: Wed, 24 Aug 2005 11:06:52 +0200
I'm new to this list and new to AppleScript.
I whipped up a script that _might_ be started from the command line.
I believe that if it is started in this way I cannot have any user
interaction, (I couldn't find any reference to 'command line' or
osascript in the AppleScript Language Guide (anno 1999). Maybe I
should file a bug...) so if the script is launched using osascript I
want it to not use any dialogs.
I use the following code to determine if the script was started from
the command line:
on run arguments
if (class of arguments = list) then
-- started from the command line
-- non interactive code goes here
return
end if
-- regular code using dialogs goes here
end run
When the script is run from Script Editor the class of arguments
seems to be 'script'. Is this a robust way of checking the way in
which the script was started, or is there a better way?
patrick
---
Tonight we're go'na script like it's 1999.
Prince
(or: when will the language guide be updated?)
_______________________________________________
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