I’m wondering if there’s a way via AppleScript to get Quark XPress to increase or decrease the size of a character by a given increment (say, 3 points) based on the character’s current size. The material I’ve looked at so far suggests that you’d need to know what size (numerically) you want to end up with, but I’ve got a workflow situation in which I’ve got to change the size of a character by 3 points relative to its original size.
I’ve got a bunch of Quark XPress files that contain several instances of a “dagger” character (†). This dagger character is in the same typeface and is the same point size as the text preceding it, but superior scripted. What I needed to do was:
a) Change this character’s typeface to Adobe Garamond (no matter what its original typeface was) and retain the superior scripting style
b) Make the dagger character three points larger than what it was originally.
I downloaded an AppleScript by Ryan Colley that allows you to change the typeface of numbers in a Quark file, and modified it to change the typeface and style of the dagger character (thanks, Ryan):
tell application “QuarkXPress™ 4.11”
activate
if not (exists document 1) then
display dialog “Please open a QuarkXpress Document”
–tell the current document
else
display dialog “This may take a few minutes to complete, we
will display a message when we are done.” giving up after 5 buttons {“Processing…”} default button 0
tell document 1
try
set font of every character of every story where it = “†” to “AGaramond”
set style of every character of every story where it = “†” to {on styles:{superior}}
beep 1
on error
beep 4
end try
display dialog “Your fonts were changed sucessfully” buttons {“OK”} default button 1
end tell
end if
end tell
This worked great for the typeface and style, but I don’t know how to get the script to increase the dagger’s size by 3 points. From what I’ve seen so far, I’d have to enter a numerical value for the type’s size into the AppleScript in order to change it…the problem is that these documents have body text in various sizes, and I wan the script to do the 3-point increase to the dagger no matter what the dagger’s original size is (so if it’s at 8 point, I’d want it to increase to 11 point, 10 point to 13 point, etc.).
Please forgive any redundancy in my explanation, Kjeld, and thanks for looking to help. Any info is appreciated very much.
I see your working in QXP 4, hope this one will work. I tested it in QXP 6.
I think this could take a while with longer documents.
Give it a try.
Kjeld
tell application "QuarkXPress Passport"
--define the specs of the dagger
set dagger to {font:"AGaramond", style:{on styles:{superior}, off styles:{plain, bold, italic, underline, outline, shadow, superscript, subscript, strikethrough, small caps, word underline}}}
tell every story of document 1
--Creat a list with all the references to every character of every story where it is a dagger
set theOffsets to (object reference of characters where it is "†")
repeat with i from 1 to count of theOffsets
set theChar to (item i of theOffsets)
set currentsize to size of theChar as integer --get current character size
set newSize to (currentsize + 3) as integer --set new character size
set properties of theChar to dagger --change font and styles of dagger
set size of theChar to newSize --change size of dagger
end repeat
end tell
end tell
theOffsets --Check the result to the list of references.
Kjeld,
Thanks so much for the script…it worked perfectly, even in Quark 4!
This was the key chunk of script:
repeat with i from 1 to count of theOffsets
set theChar to (item i of theOffsets)
set currentsize to size of theChar as integer --get current character size
set newSize to (currentsize + 3) as integer --set new character size
set properties of theChar to dagger --change font and styles of dagger
set size of theChar to newSize --change size of dagger
end repeat
I previously didn’t know how to tell Quark to change the size when the initial size varied with the document…the language makes sense, though.
Thanks again for helping out a newbie!
mr.pockets
P.S. What’s the best way to get a firm foothold on AppleScript? Books? Classes? I’m sort of learning AppleScript piecemeal, and it’s going to take forever if I don’t get some sort of instruction.
Thanks for the addendum, Kjeld. I was so happy that it worked the way it did that I didn’t check my test document in detail, and I hadn’t gotten to the point of applying the script to actual work. (Sloppy of me…)
I’ll definitely try the modification, and again, thanks for your help!