Quark 8 replace images script

I have a script that opens files, gets the names of missing images and then replaces them with images with the same name from a different folder (essentially updating a path).

Problem I am having is clipping paths that images use. I can’t figure out how to read and set these when replacing images. Any idea’s?

Thanks


	set inParameter to alias "Macintosh HD:Users:peki:Desktop:links 4:"


tell application "QuarkXPress"
		set myDocument to open inInputFile with Suppress All Warnings
		set DocName to name of document 1
		tell document DocName
			set horizontal measure to millimeters
			set vertical measure to millimeters
			set PageWidth to page width as real
			set PageHeight to page height as real
			
			set ImageList to {}
			try -- Wrap in TRY BLOCK so script does NOT fail if nothing is returned
				set ImageList to file path of (every image)
			end try
			set ImageCount to count of ImageList
			repeat with i from 1 to ImageCount
				tell image i
					set ImageBox to object reference of picture box 1
					-- Copy get image properties
					set Img_angle to angle
					set Img_color to color
					set Img_greek_pictures to greek pictures
					set Img_image_trap to image trap
					set Img_invert_runaround to invert runaround
					set Img_name to name
					set Img_offset to offset
					set Img_scale to scale
					set Img_screen to screen
					set Img_screen_angle to screen angle
					set Img_screen_frequency to screen frequency
					set Img_screen_function to screen function
					set Img_shade to shade
					set Img_show_half_tone to show half tone
					set Img_skew to skew
					set Img_suppress_printing to suppress printing
					-- Get new image path
					set Img_file_path to (file path) as text
					-- Get image name from image file path
					set AppleScript's text item delimiters to {":"}
					set PicName to last text item of Img_file_path
					set AppleScript's text item delimiters to ""
					set NewLink to inParameter & PicName as text
					try
						-- Re-import picture
						set image 1 of ImageBox to file NewLink
						-- Re-set image properties
						tell image 1 of ImageBox
							set color to name of Img_color
							set name to Img_name
						end tell
					end try
				end tell
			end repeat
end tell
end tell


I think you cant do this with XPress.

You can only check whether a clipping path is selected/active or not:

tell application "QuarkXPress"
	tell front document
		if exists clipping path 1 of image 1 of picture box 1 then
			log "clipping path active"
		end if
	end tell
end tell

Greets from
TMA

You’ll find all relevant information about clipping paths in Apple Events Scripting.pdf (page 122; or for runaround: page 101 or 112). I suppose you’d first have to store the properties in order to re-set them after reimporting the image. HTH.

Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)