Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCRIPTING INDESIGN: Question About Labels



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.