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.
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.
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
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.