• 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: Searching for the equivalent of coercing to type "record"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching for the equivalent of coercing to type "record"


  • Subject: Re: Searching for the equivalent of coercing to type "record"
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 07 Mar 2003 09:03:04 -0800

On 3/7/03 8:11 AM, "Emmanuel" <email@hidden> wrote:

> At 8:07 AM -0500 07/03/03, Steve Cunningham wrote:
>> I have a tab-seperated text file of the form:
>>
>> "field_name_x" (tab) "field value" (tab) "field_name_y" (tab) "field
>> value" (return)
>> "field_name_x" (tab) "field value" (tab) "field_name_y" (tab) "field
>> value" (return)
>> ... etc
>>
>> I know the set of possible field names, but not which will appear in any
>> given record or in what sequence
>>
>> What I'd like to end up with is an AppleScript record of the form:
>>
>> {field_name_x: "field value",field_name_y: "field value"}
>
> I think that you will be interested in the following snippet:
>
> do script ("{<<class usrf>>:{\"a\", \"b\"}} as record")
> --> {a:"b"}
>
> (put chevrons where suitable)


And it also works with 'run script', a Standard Addition command.

Smile and Script Debugger both have 'do script' in the Miscellaneous Suites
of their respective dictionaries. But it won't work outside those editors
when not in a tell block, nor for users without one of those apps. It won't
compile in Script Editor.

I'm sure there's a good reason for including 'do script' in the better
editors' dictionaries, but 'run script' is the one to use for general
purposes. <<class usrf>> (substitute chevrons) is a great device.

--
Paul Berkowitz
_______________________________________________
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: Searching for the equivalent of coercing to type "record"
      • From: Emmanuel <email@hidden>
References: 
 >Re: Searching for the equivalent of coercing to type "record" (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Big numbers (again) and complex routine
  • Next by Date: Re: path to selection/ASCII character 173
  • Previous by thread: Re: Searching for the equivalent of coercing to type "record"
  • Next by thread: Re: Searching for the equivalent of coercing to type "record"
  • Index(es):
    • Date
    • Thread