Re: Quark syntax for creating a new paragraph with text
Re: Quark syntax for creating a new paragraph with text
- Subject: Re: Quark syntax for creating a new paragraph with text
- From: email@hidden (Michael Sullivan)
- Date: Tue, 9 Jul 2002 16:04:56 -0400
- Organization: Society for the Incurably Pompous
>
What is the proper syntax for creating a new paragraph out of some text.
>
What I've gotten to work is:
>
>
tell application "QuarkXPress"
>
tell text box "textBoxName"
>
set newParagraph to make new paragraph at end
>
set (every text of story 1 where it is "word ") to
>
currentParagraphContents
>
end tell
>
end tell
>
Is there not some way to eliminate the extra step of replacing "word" with
>
the actual text I want. Also, I end up with an extra paragraph at the end of
>
the text box using this method that I then have to strip out.
Much as I'd like a way to do what you suggest in one line, I'm not sure
there is one that works conveniently.
I think this is the idiom you're looking for:
set theParaContents to "It is a pain in the posterior to script Xpress."
tell application "QuarkXPress 4.11"
tell document 1
tell page 1
tell text box 1
make new paragraph at end
set text of result to (return & theParaContents)
end tell
end tell
end tell
end tell
Note that you have to add the return explicitly if you are appending to
existing text and there is no trailing return.
The key here (and why you don't have to go searching on return & "word"
which is the default text for new paragraphs) is that the make command
returns the object reference of what it makes. You use this feature by
setting the text of "result" which contains the value returned by the
previous expression. If you needed to keep track of this paragraph for
future reference, you could also assign it to a variable:
make new paragraph at end
set theParagraph to result
set text of theParagraph to (return & theParaContents)
BTW, you might think that the following *should* work, if you are naive
enough to believe the Xpress dictionary. But it doesn't:
set theParaContents to "It is a pain in the posterior to script Xpress."
tell application "QuarkXPress 4.11"
tell document 1
tell page 1
tell text box 1
make new paragraph at end with properties (text:
[NO-BREAK]theParaContents)
end tell
end tell
end tell
end tell
Michael
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.