Re: Submitting Parameters
Re: Submitting Parameters
- Subject: Re: Submitting Parameters
- From: Christopher Nebel <email@hidden>
- Date: Thu, 19 Apr 2007 10:40:57 -0700
On Apr 18, 2007, at 12:42 PM, Steve Hayman wrote:
osascript /Users/ronny/Documents/Scripts/GrowlFaxNotify.scptd
I want to submit a parameter which should be processed inside the
script.
"man osascript" shows how you can pass command line arguments (as of
Tiger.) You can pick them up in a run handler via the "argv"
parameter that people don't usually use - , e.g. you write this
on run argv
return "hello, " & item 1 of argv & "."
end run
and then you run it like this
$ osascript myScript.scptd steve
hello, steve.
One clarification: you can name the "argv" parameter anything you
want; the important part is that it's the parameter immediately
following "on run". The man page uses "argv" because that's what the
parameter array is called in many other interpreters.
As Steve says, this works as of Tiger (10.4). If you want to use an
older system, there are a variety of tricks you can use, but all of
them boil down to doing text substitution on the AppleScript source
and then executing the result.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden