Need a script to update images in QXP

I need a script that I can use to run on a QuarkXpress file that will auto-update all modified images. I know that it can be accessed. I just don’t know how to code it.
Here is what is in the dictionary of Quark (for those who don’t own Quark, but really know AS coding):

image

Class image: An image
Plural form:
images
Elements:
clipping path by numeric index
Properties:
base class – see this class for additional properties

file path alias [r/o] – path to the source image for this picture
file type type class [r/o] – file type from which this image was loaded

missing boolean [r/o] – is the image missing from its saved location?
modified boolean [r/o] – has the image been modified since being placed?

I have snipped out the parts that I don’t believe relate to the issue at hand. What I want to do is create an applet that will allow me to drop a file or folder on it and it will open each file and check each of the images to see if they have been modified. Then update the images one by one. Finally, close and save.

Okay, I am asking for the world here. But I have tried all kinds of variation on the two main parts of this and I just cannot get it to work. Any and all help appreciated.

Thank you,

Jmax

Jmax,

There is an acticle on the Quark website (Apple forum) that has a script for updating images. Maybe check this to see if it is what you need.

http: www.quark.com

Tech Support > QuarkForum > Technical Support Forums > Applescript Support.

Regards,

Matt.

I think the only way to do this is to run a script that checks if an image is modified and then gets all the data about the image, Rotation, Scale…etc. After you have that data you would need to do a new scripted “get picture” and apply your info to it.

I don’t think it is a simple as…
if pictureX is modified then
tell picture box to update pictureX
end if

I haven’t run this, but something like this should do the job. Keep in mind though that this will not do work for images that have clipping paths assigned.

Good luck!
D

on run
	tell application "QuarkXPress™ 4.11"
		tell document 1
			set theCount to count of picture boxes
			set theCount to theCount as integer
			
			repeat until theCount <= 0
				tell picture box theCount
					set thePath to file path of image 1
					if thePath = null then
						
					else
						set isModified to modified of image 1
						
						if isModified then
							set theAngle to angle of image 1
							set theSkew to skew of image 1
							set theScale to scale of image 1
							set theOffset to offset of image 1
							
							set image 1 to (thePath)
							set angle of image 1 to theAngle
							set skew of image 1 to theSkew
							set scale of image 1 to theScale
							set offset of image 1 to theOffset
						end if
					end if
				end tell
				set theCount to theCount - 1
			end repeat
		end tell
	end tell
	beep
	activate
	display dialog "Done"
end run

I just tried the code you posted, with a few repeat loops to cycle through multi-page Quark docs and it works pretty good. Though there’s a section of code that needs to be done differently to work properly for rotated images (angle other than 0°):

if isModified then
set theSkew to skew of image 1
set theScale to scale of image 1
set theOffset to offset of image 1
set theAngle to angle of image 1

set image 1 to (thePath)
set skew of image 1 to theSkew
set scale of image 1 to theScale
set offset of image 1 to theOffset
set angle of image 1 to theAngle
end if

I had to put the “set angle” command to the end of list, because Quark reads the offset relative to a rotation angle of 0° but sets the offset relative to whatever rotation angle you have on your image. If you do the offset before setting the rotation angle it seems to work just fine.