• 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: Coercion of list to record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coercion of list to record


  • Subject: Re: Coercion of list to record
  • From: "Stockly, Ed" <email@hidden>
  • Date: Thu, 07 Feb 2008 11:36:16 -0800
  • Thread-topic: Coercion of list to record

>>> This should do the job for you

>>Negative! Try it with
>>set theList to {"the answer", 42, "value for pi", 3.14159265359}

  Just to be clear, the issue raised here is simply that "the answer" and
"value for pi" are not valid record labels.

This won't compile:
{the answer:  42, value for pi: 3.14159265359}

Using vertical pipes, this will compile:
{|the answer|:42, |value for pi|:3.14159265359}

So, first, if you're going to coerce a list to a record, make sure the
values you will be using are valid record labels.

If they may contain spaces, and you're fine with that, use something like
this in your repeat loop:

set end of recordItems to "|" & item x of theList & "|:\"" & item (x + 1) of
theList & "\"" as string

If you think the values may contain a vertical pipe, a quote or a "\"
character then filter those characters out or escape them.

HTH,

ES



 _______________________________________________
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

  • Prev by Date: RE: Coercion of list to record
  • Next by Date: Getting script to run with apple mail rules.
  • Previous by thread: RE: Coercion of list to record
  • Next by thread: Re: Coercion of list to record
  • Index(es):
    • Date
    • Thread