• 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 variables between scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing variables between scripts


  • Subject: Re: Passing variables between scripts
  • From: John Delacour <email@hidden>
  • Date: Thu, 19 Jun 2003 14:23:22 +0100
  • Mac-eudora-version: 6.0a23

At 5:48 am -0400 19/6/03, Stephen Swift wrote:

The problem I think is that I don't know how to write test.scpt so it
accepts the parameters. Would I use a subroutine, or can my parameter be
only a list of variables?

You can do it by setting a property or using a handler. In the second case, a single parameter containing a list is the most flexible way of passing the parameters because that way you can work with a variable number of things, whereas if you write

on handle (x,y)

then you must have no fewer and no more than two parameters.




tell listadder
set its params to {1, 2, 3}
{justdoit(), doitwithparams({4, 5, 6})}
end tell

script listadder -- or your loaded script
property x : ""
property zero_x : true
property params : {}
on justdoit()
if zero_x then set x to 0
repeat with p in params
set x to x + p
end repeat
x
end justdoit
on doitwithparams(params)
if zero_x then set x to 0
repeat with p in params
set x to x + p
end repeat
x
end doitwithparams
end script


-- JD







.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Passing variables between scripts (From: Stephen Swift <email@hidden>)

  • Prev by Date: display dialog
  • Next by Date: Error -1 When Making and naming folders
  • Previous by thread: Passing variables between scripts
  • Next by thread: Re: Passing variables between scripts
  • Index(es):
    • Date
    • Thread