• 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
Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)


  • Subject: Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)
  • From: Mr Tea <email@hidden>
  • Date: Thu, 15 Apr 2004 01:04:26 +0100

On 14 Apr 2004, at 7.14 pm, Michael Terry wrote:

set {item 1 of {1, 2, 3}, item 2 of {1, 2, 3}, item 3 of {1, 2, 3}} to {4, 5, 6}


Well, I liked that idea because it would corroborate my thinking that the left hand side of 'set''s should be first class types, but if the above were the case, then this should fail:

set {1, 2} to {3, 4, 5}

... but it doesn't.


And neither does this:

set {item 1 of {1, 2}, item 2 of {1, 2}} to {4, 5, 6}

It is almost as though the numbers on the left of 'to' are being treated as variables.

Or is it? Here are some related conundra:

set {1} to 4
--> 4

set x to 1
set {x} to 4
--> error: can't get item 1 of 4

set {"what", "the", "hey?"} to "Verrry interestink, but stoopid!"
--> "Verrry interestink, but stoopid!"

set {"what", "the", "hey?"} to 4
--> 4

set h to "hey?"
set {"what", "the", h} to 4
--> error: can't get item 3 of 4

set h to "hey?"
set {"what", "the", h} to "Verrry interestink, but stoopid!"
--> "Verrry interestink, but stoopid!"

set {"Wed", April, "14th"} to (weekday of (current date))
--> Wednesday

set a to April
set {"Wed", a, "14th"} to (weekday of (current date))
--> error: can't get item 2 of Wednesday (no error if day is converted to string)

So, it seems that a list can be converted into pretty much anything, unless it contains variables, in which case it cannot be converted to numerical values, AS constants & other things that do not have 'items'. Surely a list should be more robust than this!


T.
_______________________________________________
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.


  • Follow-Ups:
    • Re: Set [list] to [value] strangeness
      • From: Axel Luttgens <email@hidden>
References: 
 >Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb) (From: Nigel Garvey <email@hidden>)
 >Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb) (From: Mr Tea <email@hidden>)
 >Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb) (From: Michael Terry <email@hidden>)

  • Prev by Date: Re: wordx & AS
  • Next by Date: Re: Get iTune File Track by Alias
  • Previous by thread: Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb)
  • Next by thread: Re: Set [list] to [value] strangeness
  • Index(es):
    • Date
    • Thread