• 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 12:42:50 -0700

Now I see that the results and potential functionality of the two approaches are different:

Assuming my intent was to isolate objects containing non-empty keys for a specific keyname, the non-looped alternative here does not seem to suffice, since I end up with a list of keys, not a list of objects containing those keys.

But it seems to work if I create a second list of all page items and did the following (eliminating tries and validity checks):

		set allPageItems to all page items
		set keyRefs to {}
		tell all page items
			set keyList to extract label key "SOME_KEY"
		end tell
		repeat with i from 1 to (count items of keyList)
			if item i of keyList is not "" then
				copy item i of allPageItems to end of keyRefs
			end if
		end repeat
		return keyRefs

But is this significantly more efficient for a lengthy document than my original repeat loop (blow)?

		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
					end if
				end try
			end tell
		end repeat
		return itemList


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

On 10/16/06 at 11:10 AM -0700, Rick Gordon wrote in a message entitled
"Re: SCRIPTING INDESIGN: Question About Labels":

>Much better! Thanks again.
>
>------------------
>
>On 10/16/06 at 9:29 PM +1000, Shane Stanley wrote in a message entitled
>"Re: SCRIPTING INDESIGN: Question About Labels":
>
>>On 16/10/06 9:15 PM, "Rick Gordon" <email@hidden> wrote:
>>
>>>  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?
>>
>>No, but you can get all items' labels with one event:
>>
>>tell application "Adobe InDesign CS2"
> >    tell all page items of document 1
> >        extract label key "Whatever"
>>    end tell
> >end tell
>>
>>Then you could loop through the result.
>>
>>--
> >Shane Stanley <email@hidden>

--

___________________________________________________

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>)
 >Re: SCRIPTING INDESIGN: Question About Labels (From: Rick Gordon <email@hidden>)

  • Prev by Date: Re: SCRIPTING INDESIGN: Question About Labels
  • Next by Date: Reported Size issue in PSCS2
  • Previous by thread: Re: SCRIPTING INDESIGN: Question About Labels
  • Next by thread: Re: SCRIPTING INDESIGN: Question About Labels
  • Index(es):
    • Date
    • Thread