• 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: Getting the labels of a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the labels of a record


  • Subject: Re: Getting the labels of a record
  • From: Deivy Petrescu <email@hidden>
  • Date: Thu, 17 Apr 2003 00:19:14 -0400

On Saturday, March 8, 2003, at 08:09 AM, LE STANG Jean-Baptiste wrote:

I'm looking for a way to read the names of labels in a record. Does anyone know how to do it?

Jean-Baptiste


A little late, but I used a script to get the values on the record, however, it did not work well for cumbersome records.
It apparently works well for labels.
I tweaked it to work with labels, including date. It is not perfect.
The fix precludes the labels from being numbers either as text or numbers.
Here it is:

<script>
set someRec to {Key_1:{"a", 3.87, {Sub_Key_A:"A"}, name, ""}, Key_2:2, Key_3:"hello", Key_4:{current date, 3 / 77}, Key_5:{"oooo", {Sub_Key_B:"B"}, string, list}}
set keyName to " "
try
keyName of someRec
on error errnum
set AppleScript's text item delimiters to "{"
set t1 to text items 2 thru -1 of (errnum as string) as string
set AppleScript's text item delimiters to ":"
set t1 to text items 1 thru -1 of t1
set cti to (count of text items of t1) - 1
set labels to {text item 1 of t1}
repeat with j from 2 to cti
set AppleScript's text item delimiters to " "
set tt1 to text item -1 of text item j of t1
set AppleScript's text item delimiters to " "
if tt1 contains "{" then set tt1 to characters 2 thru -1 of tt1 as string
try
set tt1 to tt1 as number
on error
set end of labels to tt1
end try
end repeat
return labels
end try
</script>


Regards

Deivy Petrescu
http://www.dicas.com/
_______________________________________________
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: Getting the labels of a record
      • From: Emmanuel <email@hidden>
  • Prev by Date: Read file bug?
  • Next by Date: Timesaving Solution
  • Previous by thread: Re: Getting the labels of a record
  • Next by thread: Re: Getting the labels of a record
  • Index(es):
    • Date
    • Thread