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: Hans Haesler <email@hidden>
- Date: Tue, 9 Jul 2002 22:30:41 +0200
On Tue, 9 Jul 2002, Wadson, David wrote:
>
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.
>
>
The paragraphs I need to make are all contained in a list and are to be
>
inserted into a text box which is originally empty when the script runs...
David,
I don't quite understand your scheme. Do you loop through the list and
insert -- somehow -- one paragraph after the other? Then you could use:
---
tell document 1 of application "QuarkXPress 4.11"
tell text box "textBoxName"
copy currentParagraphContents to after last paragraph
end tell
end tell
---
'currentParagraphContents' consists of the current item of the list
and an appended return.
A faster solution: convert the list to a return-delimited string and
set the story to it, e.g.:
---
set paraList to {"one", "two", "three"}
set oD to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set currentParagraphContents to every text item of paraList as string
set AppleScript's text item delimiters to oD
tell document 1 of application "QuarkXPress 4.11"
tell text box "textBoxName"
set story 1 to currentParagraphContents
end tell
end tell
---
Hans Haesler <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.