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

Re: run parameters


  • Subject: Re: run parameters
  • From: Stan Cleveland <email@hidden>
  • Date: Thu, 10 Jan 2013 11:46:10 -0800

On Jan 10, 2013, at 10:06 AM, Luther Fuller wrote:

I can run an AppleScript application with the command:

run application pathToAppl

but I need to pass parameters to the run handler.
The run handler would have to look something like:

on run parameterList
-- do something with parameterList
end run

I don't think this can be done. At least I've tried and can't get anything to work.

Is there any way to pass parameters to a run handler?
If so, how is it done?

Hi Luther,

Here's an indirect method to pass parameters to a run handler. It's a bit convoluted, but works (in Lion, at least):

<BEGIN APPLICATION>
property gParamList : missing value
on run
if gParamList is not missing value then
-- do something with gParamList
display dialog (item 1 of gParamList)
end if
end run
on passToRunHandler(paramList)
set gParamList to paramList
run
end passToRunHandler
<END APPLICATION>

<BEGIN CALLING SCRIPT>
tell application "MacHD:Users:stanc:Desktop:RunTest.app"
launch
passToRunHandler({"Hello"})
end tell
<END CALLING SCRIPT>

As far as I can tell, the code can't be simplified any further.

Out of curiosity, why not put your code into a regular handler and call that, rather than the run handler? That's basically what the above method does.

HTH,
Stan C.

 _______________________________________________
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

  • Follow-Ups:
    • Re: run parameters
      • From: Luther Fuller <email@hidden>
References: 
 >run parameters (From: Luther Fuller <email@hidden>)

  • Prev by Date: run parameters
  • Next by Date: Automating Receive Emails
  • Previous by thread: run parameters
  • Next by thread: Re: run parameters
  • Index(es):
    • Date
    • Thread