Quark - Inserting non-breaking spaces into text

Hi there,

This ties up with my earlier post regarding unicode characters, I thought I ought to repost under a different heading.

Does anyone know how to insert a ‘non-breaking space’ into text in Quark.
I’ve tried doing it by inserting a unicode character but no luck.

Thanks in advance,

Nick

Hi Nick,

unfortunatley I don’t own Quark.
In InDesign the following example works perfect.

Assuming the contents of text frame 1 of document 1 are “test”
it will be changed to “te st” with the non-breaking space in the middle

tell application "InDesign CS"
	tell document 1
		tell text frame 1
			set a to «data utxt00A0» as Unicode text
			set b to contents
			set contents to (text 1 thru 2 of b) & a & (text 3 thru -1 of b) as Unicode text
		end tell
	end tell
end tell

Hi Stefan,

Thanks for your reply.

I’d tried something similar after your last posting but I didn’t have any luck.
Somone did tell me that Quark6 doesn’t use unicode characters, I think this could be
why I don’t get the desired result.

Any more ideas would be appreciated.

Thanks,

Nick

This is true and exactly the crucial point

Hi Stefan,

Thanks again for the reply.

Not quite sure how I’m going to get round that, may have to go down the soft return route.

Do you have any other ideas.

Thanks

Nick

the shortcut for the standard non breaking space in Quark 6 is CMD-5
Maybe you can do it with GUI scripting

The mapping of special characters is often application-specific.

So, in Quark, try manually entering, selecting and copying the character you want.

Then, in Script Editor, run this ” to see what ASCII number is returned:


ASCII number (the clipboard)


Finally, in your main script, try using ASCII character n (obviously with n being the number returned above).

Thanks for the replies Stefan and Kai.

Stefan, I was hoping to stay away from UI scripting, though it was an option I’d considered.

Kai, thanks for the script. I was hopeful it may give me something different from what I’d
already found out, unfortunately not, it gave me the value 32, which is a normal space. :frowning:

If you have any other ideas on how I might be able to insert a non-breaking space into to
some text I’d be grateful. I’ve put together a script that reads data from several columns
of an Excel file. This data is then used to populate a common, base Quark document. The
script works fine and outputs all the Quark documents with all the variable data in.
What I’m trying to do now is stop certain parts of the text from splitting across two lines.

I’m gonna have a read through the link you gave me on my unicode post to see if there are
any new avenues to try there.

Thanks again for all the help,

Regards,

Nick

Nick, for what its worth I had the same issue recently when I wanted the Alt+tab. This is plain key code but the alt is handled internally by quark as special character. I found no work around for this even tried some UI stuff but gave up. The only option was the one suggested by emma in the quark forum to make use of Xtags but im unfamiliar with this and gave up. best of luck.

I just experimented with this. It’s strange. Quark doesn’t even seem to recognize the special character itself. If you copy the non-breaking space character and then paste it in the “Find” window, Quark will find regular spaces as well as the non-breaking ones.

It may be that System Events is the only way this will work. I tried this and it does produce the non-breaking space character:

tell application "System Events"
			key code 23 using {command down}
		end tell

Model: G5 Tower (not Intel) - Script Editor ver 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

the usual Quark madness though. V7 should be much better as all the invisible characters have changed and although i’ve not tested I would bet there now unicode.

Bummer. Sorry to hear that, Nick (even though it was a bit of a long shot).

You guys are much more familiar than I with QuarkXPress, which I haven’t used now for a number of years (nor do I have a recent version with which to experiment). From your descriptions, it seems Quark uses a standard space ” but might somehow embed an additional flag in the underlying code to denote the non-breaking property. Without some knowledge of how such an approach is implemented, it would be difficult to come up with a practical solution (short of manual entry ” or its closest equivalent, input via GUI scripting).

By contrast, the conventional non-breaking space on the Mac, normally entered by pressing option-space, is ASCII character 202. This works, for example, in an application like TextEdit (adjusting the size of the resulting window should demonstrate how it works):


tell (ASCII character 202) to tell "The aim is to KEEP" & it & "SOME" & it & "WORDS" & it & ¬
	"TOGETHER - but not all of them. " to tell it & it & it & it to set t to it & it & it & it

tell application "TextEdit"
	make document with properties {text:t}
	activate
end tell


Since Quark evidently uses an entirely different method, based on some internal mechanism, a viable text encoding technique looks unlikely. At the moment, the case for GUI scripting seems a compelling one. :confused:

Hi Kai,

Thanks for your help with this one, and for the script which works perfectly with TextEdit.
When resizing the window the text reflows as it should. :slight_smile:

I tried copying the resultant text to the clipboard and pasting it into a Quark document,
however I still came up with the same result. For some reason Quark doesn’t see it. :frowning:
After I’d pasted the text into the text box I tried the little script you’d posted for
getting the ASCII value, of the character on the clipboard, which came back with the
value 202. When I try typing a command-space in Quark and then copying that to the
clipboard I get the value 32. So it looks like there’s something going behind the scenes,
in Quark, with a normal space - ASCII value 32.

I did briefly look at creating an Xpress Tags file, doing the non-breaking space insertion,
and then re-importing the text into Quark. That solution looks like it would work.

I had also considered the UI scripting option but having played around with this on a few
occasions, was a little hesitant at implementing it.

Yesterday I worked on a soft-return version which I’m going to have to use. It should achieve
the same result, I’ll just have to watch out for any anomolies. One thing that did come out of
this exercise is a better understanding of text item delimiters, things other than my fingers,
after all the typing, ‘clicked’.:slight_smile:

I think I may let this one RIP now.

Thanks again to everyone who has contributed to this query,

Cheers

Nick

P.S. If I ever come up with a solution, to the original query, I’ll be sure to come back and post it. :slight_smile: