Re: Replace all caps into plain
Re: Replace all caps into plain
- Subject: Re: Replace all caps into plain
- From: Hans Haesler <email@hidden>
- Date: Thu, 28 Dec 2006 11:41:32 +0100
On Wed, 27 Dec 2006, Jan Bultereys wrote:
>About the italics that would be a case where the 'user' could cancel the
>search... Since it has to be replaced by a 'real' italic font.
Well... I still think it would be better to include
the replacement of the fonts (italic and small caps)
in the script. There is no need for selecting the text
and showing a dialog.
Here is a script which replaces the fonts, changes the
styles and replaces 'all caps' with upper case (with a
simplified command :-).
I'm using the 'do script' method to speed up execution
(24 short stories of 28 characters, 72 text style ranges:
handler = 39.7 seconds | do script = 2.6 seconds).
But, when run from the Scripts Menu, there is almost no
difference: 2.553 seconds | 2.487 seconds.
---
tell application "QuarkXPress Passport"
activate
set selection to null
do script {changeFont}
display dialog "Done." buttons "OK" default button 1 with icon 1
end tell
script changeFont
tell document 1 of application "QuarkXPress Passport"
repeat with s from 1 to (count of stories)
tell story s
repeat with i from (count of text style ranges) to 1 by -1
tell text style range i
if font is "LTSyntaxSerif Rg" and on styles of (get style) is {italic} then
set font to "LTSyntaxSerif It"
set objRef to object reference
my setPlain(objRef)
else if font is "LTSyntaxSerif Rg" and on styles of (get style) is {italic, all caps} then
set font to "LTSyntaxSerif It"
set objRef to object reference
my setUC(objRef)
else if font is "LTSyntaxSerif Rg" and on styles of (get style) is {small caps} then
set font to "LTSyntaxSerif SC Rg"
set objRef to object reference
my setPlain(objRef)
else if font is "LTSyntaxSerif Rg" and on styles of (get style) is {italic, small caps} then
set font to "LTSyntaxSerif SC It"
set objRef to object reference
my setPlain(objRef)
else if on styles of (get style) is {all caps} then
set objRef to object reference
my setUC(objRef)
end if
end tell
end repeat
end tell
end repeat
end tell
end script
on setPlain(objRef)
tell application "QuarkXPress Passport"
tell objRef
set style to plain
end tell
end tell
end setPlain
on setUC(objRef)
tell application "QuarkXPress Passport"
tell objRef
set style to plain
set contents to uppercase (it as string)
end tell
end tell
end setUC
---
Regards,
Hans
_______________________________________________
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