Page 1 of 2

PDF output style not working

Posted: 26 Dec 2017, 11:18
by josema
Hi, I’ve been using Quark Xpress 2016 for some time now to automate with Applescript the production of PDFs with customized information. I recently upgraded to Quark Xpress 2017, and now some of my applescripts will no longer work. Specifically, when including the optional “page range” or “PDF output style” clauses. As an example; something like this used to work in Quark Xpress 2016:

export document 1 in (path to desktop folder as string) & "test.pdf" as "PDF" PDF output style "Press - High Quality/High Resolution"

But all I get now is a Syntax Error saying:

A identifier can’t go after this “"”.

If I remove the output style specification the script does indeed work, but I need to be able to select the PDF output styles in order to generate documents for different purposes.

The QuarkXpress 2017 Applescript dictionary seems to indicate that the optional clauses should still be recognized. Has anything changed with AppleScript in QX2017 or am I doing something wrong?

QuarkXpress 2017 13.1.1 (29230), macOS High Sierra version 10.13.2

Thanks in advance.

Re: PDF output style not working

Posted: 28 Dec 2017, 04:51
by pjanssen
Well, it has something to do with the name of the PDF output style.

I did try your script and entered the name of the output style by hand and it failed. I then duplicated a standard output style and copy & pasted the name into the script. This time the script worked. I then tried to remove the last part of the name (deleted " copy"). Now the script also works.

Re: PDF output style not working

Posted: 28 Dec 2017, 13:40
by josema
Thank you very much for taking the time to look at this. I tried replicating your process in my setup but the results were the same. I duplicated the output style and copied the name into the script, but the problem here seems to lie with the “PDF output style” clause not being recognized, because when I try to run it from the Script Editor, it fails with a Syntax Error stating that it “Expected end of line, etc. but found identifier.” While highlighting the “PDF” part of the “PDF output style” clause. It won’t even compile with the hammer tool. This is all a bit baffling to me, especially since these scripts used to run fine with QX2016. If I can’t get this to work as expected I’m thinking I could probably cobble something up by manipulating the UI with System Events to have the script choose a PDF style on the fly from the pop up menu, or maybe re-installing QX2016, which would pretty much defeat the purpose of purchasing the upgrade. Quick question though; Did you run your script on QX2017 with macOS High Sierra? Maybe my problem occurs only with this specific setup.

Re: PDF output style not working

Posted: 29 Dec 2017, 11:34
by pjanssen
I did run the script with the same version of QuarkXpress 2017 as you, but on a different OS: El Capitan. Unfortunately I can't test on Sierra or High Sierra. So it's High Sierra specific. Maybe you could report this bug directly with Quark or otherwise in the Facebook group.

Re: PDF output style not working

Posted: 30 Dec 2017, 01:16
by josema
Thank you, that’s very helpful, this really might be a High Sierra-specific issue. I’ll see about filing a report as you suggested. Thanks again & a very happy New Year!

Re: PDF output style not working

Posted: 10 Mar 2018, 15:11
by josema
After editing my AppleScripts in order to work around the problems introduced by updating my software, I opened a support ticket (Ticket ID #79787), which was acknowledged on January 8.
So far, the Product team has been unable to provide an answer as to why some of the functionality of AppleScript support appears to be broken under mac OS High Sierra.
I've tried to test my AppleScripts under three additional configurations, installing Quark Xpress 2017 in a Mac Mini, a MacBook Pro and an iMac Pro, all of them running High Sierra. In every instance AppleScript commands that used to work flawlessly are now failing.
I'd be very interested to know if full AppleScript support for High Sierra will be reinstated by upgrading to Quark Xpress 2018, or if the problems found in the current version are likely to remain.

Re: PDF output style not working

Posted: 16 Mar 2018, 10:19
by jlake
After upgrading to High Sierra (now using 10.13.3), I'm having the same error when compiling my scripts written for QuarkXPress 2017 v13.2.1. It seems to be related to a command from the PDF Suite in the QXPScriptingAdditions.osax.
tell application "QuarkXPress 2017"
export document 1 in WebPath as "PDF" PDF output style "Onofrio PDF MACH5 Output Style"
end tell
"Syntax error: Expected end of line, etc. but found identifier."
The text "PDF" in PDF output style is highlighted as the error.

This line used to work, and the scripts that were compiled before they were saved run just fine with the command, but I cannot edit and recompile the scripts without commenting out the "--PDF Output Style..." part of the line. It's still listed in the QuarkXPress 2017 dictionary:
[PDF output style text] : Output style to be used: Default is Captured Settings

It acts like when you have two osaxen installed with conflicting syntax. I tried removing the other osaxen, with no effect to this problem. I also noticed that the QuarkXPress 2017 package in Applications folder contains a Library:ScriptingAdditions:QXPScriptingAdditions.osax. Is the one in Library:ScriptingAdditions no longer needed? I've compiling with and without, with no difference.

Re: PDF output style not working

Posted: 23 Mar 2018, 14:19
by jlake
Interestingly, when I quit QuarkXPress 2017 and start QuarkXPress so that applescript editor uses the older version of QXP, it still won't compile because of the 'PDF Output Style' part of the command. This applescript command previously worked in this version of QuarkXPress, so it must be something in High Sierra itself causing a conflict.

Re: PDF output style not working

Posted: 23 Mar 2018, 14:30
by jlake
I've also tried disabling SIP (System Integrity Protection) and compiling the script, with no effect.

Re: PDF output style not working

Posted: 24 Mar 2018, 15:48
by josema
I suspect that this is not an issue that we’ll be able to fix on our end. The QuarkXpress 2017 product team set up a remote session in which they took control of my machine and tried to run the script several times. They checked software versions, settings, etc., but they seem to be as stumped as we are about this. They’ve asked me perform simple procedures, such as:

select the PDF Suite in the QuarkXpress 2017 AppleScript dictionary and send them a screenshot of the window that opens up.

Run the following command in the Terminal:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.fram ework/Support/lsregister -kill -r -domain local -domain system -domain user

Check that the Script Editor has the following items unchecked:
Script Editor > Edit > Substitutions > “smart quote” and
Script Editor > Edit > Substitutions > “smart Dashes”

Search for every “T” folder within the tree structure of “/var/folders/” and delete all the contents inside TemporaryItems.

None of these measures have made any difference. I told them that I’ve tested this on four different High Sierra machines (two of them were new machines out of the box with no other software installed besides Quark Xpress), and I’ve asked them to confirm if they’ve been able to run the scripts successfully under macOS High Sierra, but they haven’t done so yet, so I’m assuming that they don’t have a High Sierra setup available and that’s why they asked to test remotely on mine.

The way I’ve gotten around this limitation is to have different “base versions” of the same QuarkXpress document, such as: “Certificate_Web” and ”Certificate_Print” with the correct settings captured, so that I can -at a later time- open and build the contents in the appropriate one, and export as PDF without output style specification. This has kept me operational while they iron out the AppleScript bugs that manifested themselves with the arrival of High Sierra. I plan to upgrade to Quark Xpress 2018 as soon as the issues are confirmed to have been addressed.

With the current state of affairs, I really hope they don’t divert people from AppleScript development in order to try to introduce JavaScript Support. It’d help no one to have two half-baked scripting environments.