Quirks of Annotate script
Quirks of Annotate script
- Subject: Quirks of Annotate script
- From: "Ripka, Herb" <email@hidden>
- Date: Thu, 28 Dec 2006 16:29:14 -0600
- Thread-topic: Quirks of Annotate script
The following "Annotate" script is based on a version from Shirley Hopkin's book "AppleScripting QuarkXpress". It gets the filename and the scale percentage of the CT file used for every Quark picture box, and puts that info into a small yellow text box in the upper left corner of the corresponding picture box.
The script works great, but it has four Really Annoying Quirks (I have no idea why these happen):
1 - Sometimes, Multiple duplicate text boxes in the same position, sometimes as many as 25! (?)
2 - Displaced text boxes, sometimes onto the right-hand side of the spread, sometimes 1 spread later, which should be deleted (??)
3 - sometimes, a box with "0 0" is created. (???)
4 - Picture boxes that originate off of the left side of the pasteboard, may stop the script. (????) Our page trim is the pasteboard, and bleed off beyond the edge of the pasteboard. Workaround: Just pull the edge of the box onto the pasteboard, then run the script. But why does it make the script stop?
Are any improvements possible?
--Herbert Ripka
Greendale, WI
set otp to 0
set olft to 0
set filename to 0
set sc1 to 0
set sc2 to 0
tell application "QuarkXPress"
if (document 1 exists) then
tell document 1
set properties to {horizontal measure:points, vertical measure:points}
repeat with p from 1 to (count of pages)
tell page p
repeat with i from 1 to (count of picture boxes in it)
if not (count of images in picture box i) = 0 then
tell picture box i
if not (bounds of image 1) = {0, 0, 0, 0} then
set name of it to "p" & p & "picbox" & i
set filevar to file path of image 1 of it as text
set filename to my getfileName(filevar)
copy (scale of image 1 of it as list) to {sc1, sc2}
copy (origin of bounds of it as list) to {otp, olft}
end if
end tell
make text box at beginning with properties {bounds:{otp, olft, ((otp as real) + 14), ((olft as real) + 175)}, color:"yellow", name:"annotate" & i, runaround:none runaround}
tell (story 1 of text box ("annotate" & i))
set properties to {font:"Times", size:12}
set contents of it to ("" & filename & " " & (sc1 as text))
end tell
end if
end repeat --picture boxes
end tell
end repeat --pages
end tell
else
display dialog "Must have document with graphics open for this script to work"
end if
end tell --application
on getfileName(path)
set pathstr to (path as string)
set lastColon to (offset of ":" in (reverse of (characters of pathstr)) as string) of pathstr
return text from -(lastColon - 1) to -1 of pathstr
end getfileName
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden