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