I am trying to update an old script that removes the old pseudo character styles and changes the font and style if necessary. The old version of the script works sometimes, but not consistently. Below is a quick script that gets styles and fonts from the current document, but something is amiss. The ‘on styles’ always appear the same: italic, shadow, superscript, superior, all caps. I have verified that this is incorrect on many different files. These results are returned consistently, and incorrectly. Is this a Quark bug? Can anyone check this on their end to verify?
tell application "QuarkXPress"
tell front document
tell every text box
tell every character
set xFont to font
set xStyle to style
if style is not plain then
display dialog "Not Plain."
end if
if style is plain then
display dialog "Plain."
end if
end tell
end tell
end tell
end tell
This is the full script
on pathName(fileAlias)
copy fileAlias as string to xx
copy text item delimiters of AppleScript to savedDelim
set text item delimiters of AppleScript to {":"}
set q to count of text items of xx
set filePath to (text items 1 thru (q - 1) of xx as string) & ":"
set fileName to last text item of xx as string
set text item delimiters of AppleScript to savedDelim
end pathName
on open opy
set opx to 1
repeat number of items in opy times
path to desktop from user domain
set theHD to result as string
set simPath to theHD & "Upgraded Items"
tell application "QuarkXPress"
activate
open item opx of opy use doc prefs yes remap fonts no do auto picture import yes with reflow
set docpath to file path of front document
my pathName(docpath)
tell front document
repeat with x from 1 to count of text boxes
try
if ((size of last character of text box x) as real) is 7 then
tell text boxes
try
tell ((characters whose font is "New Century Schlbk") whose style is {class:text style info, on styles:{bold}})
set font to "B New Century Schlbk Bold"
set style to plain
end tell
end try
try
tell ((characters whose font is "New Century Schlbk") whose style is {class:text style info, on styles:{bold, all caps}})
set font to "B New Century Schlbk Bold"
set style to plain
end tell
end try
try
tell ((characters whose font is "New Century Schlbk") whose style is {class:text style info, on styles:{bold, italic}})
set font to "BI New Century Schlbk BoldIt"
set style to plain
end tell
end try
try
tell ((characters whose font is "New Century Schlbk") whose style is {class:text style info, on styles:{italic}})
set font to "I New Century Schlbk Italic"
set style to plain
end tell
end try
end tell
end if
end try
end repeat
close saving yes
end tell
end tell
set opx to opx + 1
end repeat
tell application "QuarkXPress"
display dialog "Done." buttons {"OK"} default button 1
end tell
end open
Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox 2.0.0.6
Operating System: Mac OS X (10.4)