I was working on a Quark find/replace applescript today and came across a slight problem.
The script worked ok and replaced the required text with the new text.
The problem I’ve got is that I want to place a ‘soft return’ between two lines, at present the code puts a ‘hard return’ in.
The code that puts the new text in looks something like this:-
"text line 1" & return & "text line 2"
When you view the text in Quark, with the invisible characters showing, you can see the ‘hard return’ or paragraph return ( I think it is).
Please can someone tell me what I need to replace the return with to put in a ‘soft return’ between the two lines.
You need to use ascii character 7 for a soft return instead of a return.
tell application "QuarkXPress"
set text of story 1 of text box 1 of page 1 of document 1 to "Test This" & (ASCII character 7) & "for soft return"
end tell
When in doubt look to the code, if you can get to it.
I remember a few years ago I was working on some scripts for placing inline graphics, and manipulating them. If you look at the text returned for a selection when you have an inline graphic selected there is actually a string of numbers. I was never able to do much with those, but they are there for some reason that has to do with that inline box. With the newer versions of Quark you might be able to do even more with the “code”, though I have no proof of this I don’t do much scripting for Quark anymore, becouse of their increasing implamentation of XML in their document format. If you can figure out how and where do apply that code you might be able to do a lot do the document and it’s formatting.
Then there is the script for counting pages in a PDF (reposted in the code exchange by one of the moderators). I couldn’t find a way to do it, and my script doesnt work in all cases. Opened a few PDF’s in BB Edit and a short while later I had a few versions of the ascii page break command that the PDF format accepts, about an hour of playing and testing later I had a script that worked for the PDF’s I was creating in the Adobe applications on my computer, though it usually didn’t work if I had made those by saving a PDF from the system’s print window.
And the first script that I wrote, back 10 years ago, was to solve a sticky problem at work. We had a job that we couldn’t handle in house, and to meet the deadline we needed to send seperated post script files out to 3 other seperators while continuing to feed our image setter. We had shifts going 24 hours a day for about a week. The problem was that Quark was saving 4 files, one for each plate, but not idenifying which plate was which, this created a bit a an orginization nightmare. So I bought my first Applescript book, opened a few of the PS files in a text editor and created a script that read through the file, identified which plate it was by the PS code and renamed the file accordingly.
Rant over, suffice it to say that even in this WYSIWYG world we live in there are is still a lot of good old ASCII code hiden somewhere that the program is using for a mark-up language, and if you can get to it then you can manipulate it to do what you want.