get System Events to keystroke an apostrophe in every text box.

Hi,

Is it possible to define a variable as System Event keystroke and get Quark to type that keystroke in every text box?

(Reason being, if I tell apple script - set story 1 of text box i to “” & theFont & “’ |-'” (this has an apostrophe before the final close quote), Quark will generate the Unicode character 0027, whereas if you keystroke the apostrophe key on the keyboard in Quark, certain fonts generate the Unicode character 2019)

The following script is what I have so far, but the System event does not work across multiple text boxes.

A Quark page has to be active with several text boxes on (my system returns over 700 fonts, but if you create a few text boxes and just let the script error after it has done those boxes)

tell application "QuarkXPress"
	activate
	set ks to ""
	set allFonts to font list as list
	repeat with i from 1 to count of allFonts
		set theFont to name of item i of allFonts
		tell document 1
			set story 1 of text box i to "" & theFont & "' |-" & my keyPush(ks)
			set size of story 1 of text box i to 14
			set font of story 1 of text box i to "" & theFont & ""
		end tell
	end repeat
end tell

on keyPush(ks)
	tell application "System Events" to tell process "QuarkXPress"
		keystroke "'"
		return ks
	end tell
end keyPush

Any help would be greatly appreciated::

Hi,
if you make a new project with automatic text frame checked, you can use this … and wait for a while :wink:

tell application "QuarkXPress Passport"
	activate
	set x to 1
	set allFonts to font list as list
	repeat with i from 1 to count of allFonts
		set theFont to name of item i of allFonts
		tell document 1
			tell text box 1
				tell story 1
					set paragraph x to theFont & "' |-"
					tell application "System Events" to tell process "QuarkXPress Passport" to keystroke "'"
					set size of paragraph x to 14
					set font of paragraph x to "" & theFont & ""
									end tell
			end tell
		end tell
		set x to x + 1
		tell application "System Events" to tell process "QuarkXPress Passport" to keystroke return
			end repeat
end tell

Hans,

Thank you, this worked fine!

I made a multi page document with linked text boxes (2 per page) before running the script.

Thanks again.