Re: QXP and changing text attributes
Re: QXP and changing text attributes
- Subject: Re: QXP and changing text attributes
- From: Shane Stanley <email@hidden>
- Date: Thu, 07 Jun 2001 09:02:50 +1000
On 7/6/01 2:46 AM +1000, Hellum Timothy, email@hidden, wrote:
>
This very likely has a simple solution, but I'm having trouble getting the
>
issue worked out.
>
>
I would like to be able to have a script check a QXP doc for instances of
>
a word, change the font's attributes (bold, size, etc) and save the document
>
with replacing. What I would like to avoid, is the script using the default
>
"fake" bold attribute and actually use the font's alternate bold
>
characterization, such as Quorum Book to Quorum Bold.
>
>
My script so far follows, but is returning the error: "Can't set font of
>
selection to "Quorum Bold" :
>
>
tell application "QuarkXPress(tm) 4.1"
>
activate
>
(*"ScriptMaster XT active"*)
>
open "Photo 4:Desktop Folder:Test File"
>
find and replace document 1 all "chequing" by "chequeing" with whole word
>
set font of selection to "Quorum Bold"
>
set color of selection to color spec "Red"
>
save document 1 in file "Photo 4:Desktop Folder:Test File" with replacing
>
without template and include preview
>
close document 1
>
end tell
>
>
Anyone have any ideas?
Several.
First, if Quorum is a properly set-up font and a bold weight exists, there
is nothing "fake" about using the bold attribute -- it will produce
_exactly_ the same result as choosing the bold variant directly. Problems
only occur when you apply the bold attribute to fonts that don't have a
bold, or in which the style linkages are damaged or missing. But that's
probably off topic here...
Second, I suggest you throw away ScriptMaster XT. Your code is a classic
example of why it's a bad learning tool: it's generating code to script
ScriptMaster, not Quark, so it won't run without ScriptMaster; and it's
generating it in such a way that it completely avoids showing you how
Quark's object model works.
Third, update to QuarkXPress 4.11. It's a free upgrade, and it makes a
difference when scripting.
Finally, play with this:
set aFile to choose file
tell application "QuarkXPress 4.11"
open aFile use doc prefs yes remap fonts no
tell document 1
try -- in case the doc doesn't contain the text
set properties of every text of every story where it = "chequing" to
{contents:"chequeing", font:"Quorum Bold", color:"Red"}
end try
end tell
close document 1 saving yes
end tell
--
Shane Stanley, email@hidden