Selecting characters from a text based on a list (QuarkXPress)

Hi.

I have a text in QuarkXPress and a list.
I need something like this:

tell application "QuarkXPress Passport"
tell front document
-- next sentence is pseudo code
set size of characters whose positions in story 1 are {3,7-9,15} to 32
-- I  need that characters 3, 7 trhu 9 and 15 adopt 32 points size

end tell
end tell

Some ideas?

Thansk in advance

Yes :wink:


set charpos to {3, 7, 8, 9, 15}

tell application "QuarkXPress Passport"
	tell document 1
		tell text box 1
			tell text 1
				repeat with charpos in charpos
					set size of character charpos to "32pt"
				end repeat
			end tell
		end tell
	end tell
end tell

Thanks.
I have already tried that solution. It’s the easy solution.
The problem it’s that it is very slow (my text is near 2.000 characters and the lists contains 100 items or more).
Each “set size …” produces a re-display of the text.
I’m looking for a more powerfull solution that don’t “walk” thru a repeat loop.
I’m looking for something like “set every character …” or so.

Thanks.

One way to speed it up is with the “do script” for Quark, if Quark Passport has the same functionality. It compiles and runs the script in Quark itself rather than in AppleScript, which makes for a noticeably faster execution.

set charpos to {3, 7, 8, 9, 15}

tell application "QuarkXPress"
	--define script
	script foo
		tell application "QuarkXPress"
			tell document 1
				tell text box 1
					tell text 1
						repeat with charpos in charpos
							set size of character charpos to "32pt"
						end repeat
					end tell
				end tell
			end tell
		end tell
	end script
	--run script in Quark
	do script {foo}
end tell

Thanks. Running as an internal script the execution time drops from two minutes to 14 seconds !!! :smiley: