System Events - "click menu item..." in QuarkXpress not working

Hi dear scripters!

I’m testing a script to “click” menu options in QuarkXpress. It works ok when I run from AppleScript Editor, but when I save the script in to QuarkXpress and execute from there,the application hangs with the spinning wheel.

This is the script:


tell application "QuarkXPress" to activate
tell application "System Events"
	tell process "QuarkXPress"
		click menu item "Save Revision to Server..." of menu "File" of menu bar 1 -- Save changes to QPP sever
		click button "OK" of window "Save Revision" -- Press Ok button in confirmation dialog
		click menu item "Discard Changes" of menu "File" of menu bar 1 -- Close and release file in QPP server
	end tell
end tell

In addition I have to say that I’m trying to “click” menu options that comes from the installed Quark Publishing Platform Client inside QuarkXpress, but I tested with native Quarkxpress menu items with same results.

Any idea? Thanks

Hi jarchscript,

What version of Quark are you using?

Thanks.

Oops sorry for missing that information. I’m using QuarkXpress 10.5.2 with Quark Publishing Platform Client 10.5. Mac OS X 10.9.5
Thanks.

May you try with this slightly modified code :

tell application "QuarkXPress" to activate
tell application "System Events"
   tell process "QuarkXPress"
set frontmost to true # ADDED
       click menu item "Save Revision to Server..." of menu "File" of menu bar 1 -- Save changes to QPP sever
       click button "OK" of window "Save Revision" -- Press Ok button in confirmation dialog
       click menu item "Discard Changes" of menu "File" of menu bar 1 -- Close and release file in QPP server
   end tell
end tell

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) mardi 3 novembre 2015 18:42:58

Thank you Yvan.
I tried the modified code with same previous results.
Works ok when launched from AppleScript Editor but lauched within QuarkXpress hangs the application. No idea what would be happening.

Isn’t it the instruction :
tell application “QuarkXPress” to activate
which is the culprit ?

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) mardi 3 novembre 2015 19:36:26

Nope. I removed that line with no changes (still working from AS Editor).
I also added :
click menu item “Save Revision to Server…” of menu “File” of menu bar item “File” of menu bar 1

instead of :
click menu item “Save Revision to Server…” of menu bar item “File” of menu bar 1

No changes :frowning:

AppleScripting QuarkXPress sometimes lead to such behaviours. Since several years now, on a friend’s advice, I run scripts from a third party top bar menu (FastScripts Light). Worth a try.