• 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: set variables, in mass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set variables, in mass


  • Subject: Re: set variables, in mass
  • From: "Adam K. Wuellner" <email@hidden>
  • Date: Tue, 30 Nov 2004 10:15:45 -0600


On Nov 30, 2004, at 8:56 AM, Robert Poland wrote:

Hi,

I think this is a feature(s) request. Or at least a request for more learning. The following script items seem like they should work.

local a = 0 won't compile, is there some syntax I'm missing here?

a = 0 is an equality test in AppleScript, and the only assignment functions are 'set' and 'copy', as in
set a to 0 -- a now has 0
copy a to b -- b now has 0
You can't declare a variable's scope and assign to it in the same statement. You can in Perl, and you can declare a variable type and assign to it in the same line in C++, but this, for better or for worse, is AppleScript.


local a, APOD, apodEXT... seems to work.

Well, that is valid syntax. You can declare the scope of multiple variables by separating the variable names with commas.


set {a, APOD, apodEXT, apodName} to "test"

You can set a list of variables to a list of values. In the above, AppleScript seems to be coercing the string on the right side of the assignment to a list and setting a to "t", APOD to "e", apodEXT to "s", and apodName to "t". If you want all variables to be set to the same thing, you have to do something like this:
set {A, B, C, D} to {"val", "val", "val", "val"}
If you've got a lot of variables, you could build up the value-list programatically, but you'll always need one value for every item in the variable-list.


Someone please correct me if I'm wrong on any of the above points.

Also, see the official language guide, on variables:
<http://developer.apple.com/documentation/AppleScript/Conceptual/ AppleScriptLangGuide/AppleScript.96.html>
(be sure to click "Next ->" a few times)


_______________________________________________
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


  • Follow-Ups:
    • Re: set variables, in mass
      • From: "halloolli" <email@hidden>
    • Re: set variables, in mass
      • From: Emmanuel <email@hidden>
References: 
 >set variables, in mass (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Repeated opening of a Quark document
  • Next by Date: ejecting a mounted disk image under 9 and X
  • Previous by thread: set variables, in mass
  • Next by thread: Re: set variables, in mass
  • Index(es):
    • Date
    • Thread