• 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: passing a parameter to the run handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing a parameter to the run handler


  • Subject: Re: passing a parameter to the run handler
  • From: John Rethorst <email@hidden>
  • Date: Tue, 26 Jul 2005 08:25:27 -0700


On Jul 25, 2005, at 11:27 PM, applescript-users- email@hidden wrote:


On 26 Jul 2005, at 12:57 PM, John Rethorst wrote:

An application I use can send a run event to another application
and pass a parameter, in this case a URL. I'd like to direct this
run event to an applet, e.g.:

on run (theURL)
-- process theURL
end run

Matt Neuberg's book discusses passing a parameter to a script
object, but not to the parent script. Is that possible?


From Standard Additions:

run script: Run a specified script or script file
run script script -- the script text (or an alias or file reference
of a script file) to run
[with parameters a list of anything] -- list of parameters
[in plain text] -- the scripting component to use; default is the
current scripting component
Result: anything -- the result of running the script



-- calling script run script alias "path:to:target:script" with parameters {param}

--  target script
on run {param}
    doSomething(param)
end

There's no calling script here; it's an application sending a run event. The target applet is:


property myBrowser : 0

on run {theURL}
    if myBrowser = 0 then chooseBrowser()
    getURL(theURL)
end run

on chooseBrowser()
set myBrowser to choose file of type "APPL" with prompt "Choose a web browser:"
end chooseBrowser


on getURL(theURL)
    tell application (myBrowser as string)
        activate
        «event WWW!OURL» theURL given «class WIND»:0
    end tell
end getURL


--> «script» doesn't match the parameters {theURL} for run


_______________________________________________ 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
  • Prev by Date: Re: Really dumb question . . .
  • Next by Date: Re: set myList to myList & ... and unexpected results
  • Previous by thread: Re: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
  • Next by thread: Re: passing a parameter to the run handler
  • Index(es):
    • Date
    • Thread