(*

Set Scale of every Picture in every Picture Box to 100%

This works with Quark express 4.1.1 and PhotoShop 8 (CS) and keeps a running list of the images so it doesn't resize the same image twice. Adobe PhotoShop 8 scripting interface seems to expect percentage values for image resizing as a fraction of 1 vs 100, ie, it expects the value .5 for 50% rather than 50 for 50% like PhotoShop 7 did.

the same set scale of picture box quark/photoshop applescript for photoshop 7

*)

tell front document of application "QuarkXPress™ 4.11"
	activate
	--	try
	--select none
	
	set numPages to count of every page
	set imageList to {}
	repeat with i from 1 to numPages
		set boxCount to count of every picture box of page i
		--	display dialog boxCount
		repeat with bx from 1 to boxCount
			set bxContent to (file path of every image of picture box bx of page i)
			
			if bxContent ≠ null then
				--display dialog bxContent
				set bxScale to (scale of image 1 of picture box bx of page i) as list
				set bxPercent to (coerce item 1 of bxScale to real)
				--display dialog bxPercent default answer bxPercent
				if bxPercent ≠ 100 then
					if bxContent is not in imageList then
						tell application "Adobe Photoshop CS"
							open file (bxContent as string) showing dialogs never
							set docRef to current document
							resize image docRef width (bxPercent / 100) as percent resample method none
							close docRef with saving
						end tell
						set imageList to imageList & bxContent
					end if
					set scale of image 1 of picture box bx of page i to {"100", "100"}
				end if
			end if
		end repeat
	end repeat
end tell

beep
delay 1
try
	say "duh duh duh duh done"
	display dialog "done resizing now."
on error
	display dialog "done resizing now."
end try

beep




-- previous version for photoshop 7

-- applescript page