• 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: SCRIPTING INDESIGN: Question About Labels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCRIPTING INDESIGN: Question About Labels


  • Subject: Re: SCRIPTING INDESIGN: Question About Labels
  • From: Rick Gordon <email@hidden>
  • Date: Mon, 16 Oct 2006 04:15:58 -0700

Title: Re: SCRIPTING INDESIGN: Question About Labels
Thanks, Shane. Two queries inline below.

Rick

------------------

On 10/16/06 at 8:25 PM +1000, Shane Stanley wrote in a message entitled
"Re: SCRIPTING INDESIGN: Question About Labels":

On 16/10/06 7:54 PM, "Rick Gordon" <email@hidden> wrote:

> 1) How do you delete keys and their associated values? There does not appear
> to be a delete label key command.
Just set them to an empty string.

----
Ah, I see now that using extract label to a non-existing key does not generate an error, it returns an empty string.
------------------

> 2) Why does this appear to be completely separate from the label string
> (unkeyed) that is accessible through the Script Labels palette or through the
> syntax...
>
> set label to <VALUE_AS_STRING>
>
> ...and...
>
> get label

Because it *is* completely separate from the label string. It's really a way
of storing data associated with an element. By allowing you to set a key,
you don't have to worry about other scripts accidentally deleting your data.
>
> 3) Why do the keys not show up as a property value of the object(s) to which
> they're associated with?
Because they're not properties, they're objects.

----
OK, this is clearer now. So, short of a repeat loop running through each object, is there some way to seek out every object that has a key with some specific name? As with plain labels, you could do:

        set itemList to every item of all page items whose label is "WHATEVER"

The best I can come up with with keyed labels would be something like the following:

        set itemList to {}
        set itemCount to count items of all page items
        set pageItems to all page items
        repeat with i from 1 to itemCount
                tell item i of pageItems
                        set extractedLabel to extract label key "SOME_KEY"
                        try
                                if extractedLabel is not "" then
                                        set end of itemList to object reference of item i of pageItems
                                end if
                        end try
                end tell
        end repeat
        return itemList

------------------


--
 
___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________
WWW:   http://www.shelterpub.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: SCRIPTING INDESIGN: Question About Labels
      • From: Shane Stanley <email@hidden>
References: 
 >Re: SCRIPTING INDESIGN: Question About Labels (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: TextEdit find/replace script
  • Next by Date: Re: SCRIPTING INDESIGN: Question About Labels
  • Previous by thread: Re: SCRIPTING INDESIGN: Question About Labels
  • Next by thread: Re: SCRIPTING INDESIGN: Question About Labels
  • Index(es):
    • Date
    • Thread