Re: Quark Paragraph Numbers and other QuarkNewbie Questions
Re: Quark Paragraph Numbers and other QuarkNewbie Questions
- Subject: Re: Quark Paragraph Numbers and other QuarkNewbie Questions
- From: Hans Haesler <email@hidden>
- Date: Thu, 16 Nov 2000 18:25:18 +0100
On Thu, 16 Nov 2000, Alixandra Leigh wrote:
>
xandra
>
a quark newbie
Welcome aboard ;-)
>
1. How does one get the paragraph number(s) of a selection in Quark.
I'd try to get the object references:
---
tell application "QuarkXPress 4.11"
set objRef to object reference of every paragraph of selection
---
If there is more than one paragraph, the class of 'objRef' is 'list'.
With only one paragraph the class would be 'text flow'. So you must
test the class and coerce 'objRef' to a list if necessary.
---
if class of objRef is not list then set objRef to {objRef}
---
(Else, if 'objRef' is not a list you can't loop through it.)
---
tell application "QuarkXPress 4.11"
set objRef to object reference of every paragraph of selection
if class of objRef is not list then set objRef to {objRef}
repeat with aPara in objRef
try
set font of character 1 of aPara to "Times"
on error
end try
end repeat
end tell
---
The try wrapper is there to avoid an error message: There could be
a Return at the end of the text, creating an empty paragraph.
>
set oldText to paragraphs of the selection --> list of paragraph
>
>contents
It would be better to use the object reference (see above), that's
(in most cases) less "heavy" than using the contents.
>
set sel to offset of paragraphs of the selection
>
--> {4094, 4583} (character offset from where? story? doc? can this be
>
used?)
It is the offset from the start of the story. It could be used,
but I think you don't need it here.
To change the font of the first character, based on Jason's snippet:
---
tell application "QuarkXPress 4.11"
tell selection
copy return & tab to before every paragraph
tell every paragraph
set font of characters 1 thru 2 to "Times"
end tell
end tell
end tell
---
>
2. HOW DOES ONE FIND/Replace text within Quark using Applescript I don't
>
see any commands for this?
Use something like this:
---
tell document 1 of application "QuarkXPress 4.11"
set every text of every story where it is "a" to "b"
end tell
---
Please note that a *direct* Search/Replace in a text box is not
case sensitive.
Hans
---
Hans Haesler | email@hidden