Quark: How to add text with differnt styles


Quark makes me crazy …

I want to add some text to a text box and I use the following code:

tell application “QuarkXPress Passport”
tell current box
make text at end with properties {contents:“TEST 1”, style:bold}
make text at end with properties {contents:“TEST 2”, style:italic}
end tell
end tell

the result is that “TEST 1” is bold, but “TEST 2” is bold and italic. Whats wrong
with my code ?

any suggestions ?

Best regards

See below…

Hi :slight_smile:
You are the “on styles” and “of styles” properties, here an exemple :

tell application "QuarkXPress 3"
	tell document 1
		tell current box
			make text at end with properties {contents:"Test 1", style:¬
				{on styles:{bold, italic, all caps}, off styles:{plain, underline, ¬
					outline, shadow, superscript, subscript, superior, ¬
					strike thru, small caps, word underline, hidden}}}
		end tell
	end tell
end tell


Well, I didn’t mean to post the other response. It is wrong. I played around with this and the code below works. Fredo is right, you need to specify the entire style record for each piece of text to tell Quark which styles are on styles and which styles are off styles. If you don’t specify the entire style record, Quark assumes that it is supposed to apply the new style in addition to the style already specified.

Try this:

tell application "QuarkXPress Passport" 
tell current box 
make new text at end with properties {contents:"Test 1", style:{on styles:{bold}, off styles:{plain, italic, underline, outline, shadow, superscript, subscript, superior, strikethrough, all caps, small caps, word underline}}}
				make text at end with properties {contents:"Test 2", style:{on styles:{italic}, off styles:{plain, bold, underline, outline, shadow, superscript, subscript, superior, strikethrough, all caps, small caps, word underline}}}
end tell 
end tell 

Salut, Fredo. Ca va? Nous nous rencontrons toujours dans les memes places, n’est ce pas?

Good luck.


Working with on styles/off styles is a hassle, and often scripting text in this way is slow as well–even when you are cutting down on as many events as possible, as you are, by using a with properties statement.

In Quark, if you are dealing with any signficant amount of text, it is often better to just create an XPress Tags file, and import that via AppleScript. It is also very fast. Just use open for access/write to quickly create a temporary file, then tell Quark (the app) to “set import styles to true”. Then you tell a text box to “set story 1 to alias text:path:here”, and your formatted text is imported.

It is also a bit easier to set styles as you can use a tag to return any text to plain before applying bold or italic.

I really work with text this way most of the time, but I’m overly addictive to working with ASCII.

Don’t know if this is appropriate in your project, but I wanted to pass it along.



Can you post some sample code for the process you described? I really like the way it sounds. Of course, I can figure it out on my own but having some code would simplify the process.

Also, do you have any pointers on scripting style sheets? I’ve been and will be working intensively with style sheets and any input to help me improve my skills would be great.

Thanks & Cheers.


thanks. With Quark 6 the second text is still bold …
I use Quark 6 with MacOS X 10.2

Any suggestions for a workaround ?


Put some XPress Tags in the variable “theTags” and use this code. You’ll just need to change the version in the first line depending upon the version of Quark you are using–and the XPress Tags versions does not necessarily match the app version.

set theTags to "<v6.00><e0>" & return & theTags
set prefPath to (path to preferences) as string
set tagPath to prefPath & "XPress Tags Temp"

--create a text file
	--try closing it first in case it was left open
	close access file tagPath
end try
set fileRef to (open for access file tagPath with write permission)
set eof fileRef to 0
write theTags to fileRef
close access fileRef

--import the text file in to Quark
set tagPath to (tagPath as alias)
tell application "QuarkXPress"
	set import styles to true
	tell document 1
		tell text box "whatever"
			set story 1 to tagPath
		end tell
	end tell
end tell

For anyone excited about working with XPress Tags, I also recommend taking a look at the demo version of Em Software’s XTags XTensions…


It has several things that make it easier to learn XPress Tags, including:

  1. A “Copy as Xtags” feature so you can quickly look at how your formatted text translates to tags without having to “Save Text” and open an external file.

  2. A preference setting to output all tags as separate tags, which learning and manipulating tags much easier.

  3. Another preference that allows you to skip the exporting of style sheet definitions.

The real power of the XTension lies in its enhancement of XPress Tags, including the ability to describe text boxes and picture boxes as tags, and import these tags using AppleScript.

Disclaimer: In addition to being a decade-long Em Software user, I also help out sometimes with the company’s tech support.

I haven’t worked with scripting style sheets much directly, because most of my jobs use templates with style sheets predefined. I have heard that it is a buggy area in QuarkXPress scripting.

But notice that when you save any text as XPress Tags it also exports style sheet definitions at the top of the file. So if you want to create style sheets from scratch, you can do so by importing XPress Tags with the definitions. I believe this will work to modify existing style sheets as well.


Hi Guys,

I am using Macintosh X (Mountain Lion), Quark Xpress Version 9.5 and Applescript Version 2.6.

While I am searching to import xpress tag into quark. I got the below thread.

As per the thread instruction, I have changed the first line as per my quark version.

But while I compiling the script, I got an error “A identifier can’t go after this identifier” in the below line.

set import styles to true

Can anyone help?


Flag should be <v9.54> – provided you have the latest version of 9 running AND provided encoding is UTF-16.
You may also read this piece of information related to XPress Tags: https://quark.parature.com/link/portal/30026/30029/Article/1106/Working-with-XPress-Tags-in-QuarkXPress

HTH. (I used to have somewhere on my machine a exhaustive list of versions and encodings but can’t find it anymore! Mind the version here is not necessarily reflecting with accuracy the actual version of the application.)

BTW could you post the code you have so far?