• 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 16:39:03 -0700

My test on a 200-page document with one object per page, where the object on every third page had a key inserted showed that the first snippet ran more twice as fast as the second (about 3 seconds to 7 or eight seconds -- still both usably fast):

#1:

tell application "Adobe InDesign CS2"
	tell active document
		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
	end tell
end tell

#2:


tell application "Adobe InDesign CS2"
	tell active document
		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
	end tell
end tell


Rick Gordon

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

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

>On 17/10/06 5:42 AM, "Rick Gordon" <email@hidden> wrote:
>
>> But is this significantly more efficient for a lengthy document than my
>> original repeat loop (blow)?
>
>Probably, because you've reduced the number of commands sent to the app. but
>the way to know for sure is to try them both -- and then you tell us.
>
>--
>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

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

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