• 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 label from a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting label from a record


  • Subject: Re: Getting label from a record
  • From: EBI Aktivitet <email@hidden>
  • Date: Thu, 20 Nov 2003 08:54:50 +0100

Den 03-11-19 23.07, skrev "Emmanuel" <email@hidden>:

> I've seen you got several replies, however you may want to consider using
> Smile since it does include specific tools for that kind of thing - more
> generally, for manipulating scripts by script.
>
> The script belows finds all labels that do not include a colon (a rather rare
> case, you would admit). To find also those that include a colon you need a few
> additional lines, that would not help understanding how the script works.
>
> The strategy here is 1. making the record into text (Smile's 'display'
> command) - 2. finding the first label (here I just locate the first occurrence
> of ":") (Satimage osax' 'find text' command) - 3. suppressing the said label
> out of the record (Satimage osax' 'suppress item' command) - then iterate
> until record is empty.
>
> ---------------------------------------
> on GetLabels(r)
> set labs to {}
> repeat
> set n to count r
> if n = 0 then return labs
> set lab to find text "\\{(\\|?)([^:|]+)\\|?:" in (display r) using "\\2" with
> regexp and string result
> set end of labs to lab
> set r to suppress item lab from r
> try
> if n is (count r) then set r to do script "suppress item " & lab & " from " &
> (display r)
> end try
> end repeat
> end GetLabels
> ---------------------------------------
>

Thanks Emmanuel, that9s really cool! I actually downloaded Smile yesterday,
to have a look at what it could do for me. Problem is, I'm stubbornly trying
to do it all in vanilla, but after seeing your solution I might have to
rethink... :-)

Regards, Adim
_______________________________________________
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.

References: 
 >Re: Getting label from a record (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Read text error
  • Next by Date: Re: How do I return current user information
  • Previous by thread: Re: Getting label from a record
  • Next by thread: Re: Getting label from a record
  • Index(es):
    • Date
    • Thread