• 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: Submitting Parameters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Submitting Parameters (From: Ronald Hofmann <email@hidden>)
 >Re: Submitting Parameters (From: Lee Noble <email@hidden>)
 >Re: Submitting Parameters (From: Steve Hayman <email@hidden>)

  • Prev by Date: Re: Path to DeskTop
  • Next by Date: start method when closing the applescript app
  • Previous by thread: Re: Submitting Parameters
  • Next by thread: Re: Submitting Parameters
  • Index(es):
    • Date
    • Thread