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



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:
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.