I am trying to change the file path of every image in a quark document (ver 6.5) to other file path.
I am able to get the file path of every image. But I get struck in changing the file path to other file path.
For example. If a quark document contains a image from the path “BOOKS:70987 XXX:IMAGES:FIG01.EPS”. It should be changed to “BOOKS:80187 YYY:IMAGES:FIG01.EPS”. Like this the path name of every image should be changed.
My script is:
tell application “QuarkXPress”
activate
set Doc_Name to name of document 1
tell document Doc_Name
repeat with This_Image from 1 to count of image
tell image This_Image
display dialog "Tne file path is: " & file path
-- Here I NEED TO CHANGE THE FILE PATH
end tell
end repeat
-- try
-- set the file path of image 1 of picture box 1 to "Mac9:Users:mac9:Desktop:New:AAFYIWQ0.EPS"
-- end try
end tell
Is there any other way (or script) to change the file path. Because we have lot of quark documents where the file path of images should be changed. Doing this manually will take more time.
As far as I know, you can not just change the path. You would need to re-place each image, directing it to the new path.
I didn’t have time to test this but I think this is the basic format you want. If your images are scaled down and are not placed at 0,0 for x and y coordinates, you might need to add some code to get those values and then reapply them to the newly placed image.
Hope this helps:
tell application "QuarkXPress"
activate
tell front document
set tool mode to drag mode
repeat with Countr from 1 to count of picture boxes
tell picture box Countr
try
set CheckTempPath to file path of image 1 of it as text
--You might need to get the scale and x.y placement here
on error --There is no image in this box so skip this one
exit repeat
end try
set AppleScript's text item delimiters to "70987 XXX"
set TheTempValue to CheckTempPath's text items as list
set AppleScript's text item delimiters to "80187 YYY"
set FinalFilePath to TheTempValue as text
set AppleScript's text item delimiters to ""
set image 1 of it to FinalFilePath
--Reapply scale and x,y placement if necessary.
end tell
end repeat
end tell
end tell
Model: G5 OSX 10.4.8
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
Far as I know, “set file path of image 1” doesn’t work, but the working equivalent is just “set image 1” which will change the file path. Also resets all the properties to default, such as scale, rotation, etc.