This script works OK if I run it from script editor or script debugger but if run it within Quark pull down scripts menu I get this Error: -1719 System Events got an error: Can get menu bar of process “QuarkXpress”. Invalid index. What am I doing wrong? I need help please. Our IT guy is suggesting me to use Automator since it can record steps but I rather use Applescript. I not pursuing printing a postscript anymore because the pdf boxes like trim & bleed are missing when the final is pdf is created. (My friend posted this in the Quark forums too but this site is more reliable)
tell application "QuarkXPress"
activate
try
tell document 1
set DocName to name as text
end tell
tell application "System Events"
tell process "QuarkXPress"
tell menu bar 1
tell menu bar item "File"
tell menu "File"
tell menu item "Export"
tell menu "Export"
click menu item "Layout as PDF..."
end tell
end tell
end tell
end tell
end tell
tell window "Export as PDF"
delay 20 --allows me time to select the correct PDF style settings
--click button "Save" of window "Export as PDF" -- currentlly not working I get this Error:-1728. System Events got an error: Cant get window "Export as PDF" of process "QuarkXpress". I'm clicking save button
end tell
end tell
end tell
close document 1 saving no -- I need the document close as soon it finish saving the pdf from the window Export as PDF
on error the error_message number the error_number
set the error_text to "Error: " & the error_number & ". " & the error_message
display dialog the error_text buttons {"OK"} default button 1
return the error_text
end try
end tell