Re: Updating modified in Quark.
Re: Updating modified in Quark.
- Subject: Re: Updating modified in Quark.
- From: Hans Haesler <email@hidden>
- Date: Tue, 10 Apr 2001 22:28:04 +0200
On Tue, 10 Apr 2001, Marty Brandt wrote:
>
Is there a script command that will update modified in Quark?
Yes: 'set image 1 to filePath' (where file path is the stored path
to the image file).
With this command the image is imported okay (if it exists).
BUT: all changes to the scales, the offset and so on will be lost.
All this has to be stored, before re-importing the image:
---
tell document 1 of application "QuarkXPress 4.11"
activate
set n to count of picture boxes
if n is greater than 0 then
repeat with i from 1 to n
tell picture box i
if (bounds of image 1) is not {0, 0, 0, 0} then
if (file path of image 1) is not null then
try
set LeftToRight to flipped horizontal
set TopToBottom to flipped vertical
tell image 1
set iPath to (get file path) as text
set iSca to scale
set iOff to offset
set iAng to angle
set iSkw to skew
set iCol to name of color
set iShd to shade
end tell
set image 1 to iPath
set properties of image 1 to {scale:iSca, offset:iOff, angle:iAng, skew:iSkw, color:iCol, shade:iShd}
if LeftToRight or TopToBottom = true then
set properties to {flipped horizontal:LeftToRight, flipped vertical:TopToBottom}
end if
on error
end try
end if
end if
end tell
end repeat
end if
end tell
---
This script loops through all picture boxes of the front document.
If 'bounds' of an image is not {0, 0, 0, 0} (else the box is empty) and
if the file path is not 'null' (else there is no disk file) then the most
frequent properties are stored.
The variables 'LeftToRight' and 'TopToBottom' are set to 'true' or 'false'.
'iPath' is set to the path to the image file. Followed by 6 variables
which store the rotation (= angle), the Y- and X-scales, the skew,
the Y- and X-offset, the name of the color with which a TIFF file has been
colored and the shade of the color.
Then the image is loaded: 'set image 1 to iPath' and the stored properties
are applied in one sweep, except of the "flips" which are properties of
the picture box and are applied only if one of them is 'true'.
The storing and applying of the properties is in a try wrapper.
The reason for this: if an image is 'missing' then you don't get an error
message which would stop execution.
This script imports every image, regardless of the status. It would
be possible -- but more complicated -- to test if an image is modified
or missing (but don't rely on the properties). If you'd prefer such a
solution then send me a message, please.
Just be aware that the above script will fail if there is an image with a
user modified runaround polygon or when it is not restricted to box.
While something can be done about the first case, the second is hopeless...
Note, too, that an image with a rotation and/or a skew and which has been
pushed -- manually -- to the limits of the offset values, can't be
re-imported as before. The offset will generate the error and the angle,
the skew, the eventual color and the shade will be set to 0, 0, Black, 0...
Regards,
Hans
---
Hans Haesler | email@hidden