I have written a script that works on its own or when I run it from Automator. But when I add it as a service to QuickBooks I get and error message:

"The action Run AppleScript encountered an error."

This is the script :

activate application "QuickBooks 2016"
set windowtitle to the name of the front window of application "QuickBooks 2016"
tell application "System Events"
    tell process "QuickBooks"
        click button "Print" of toolbar 1 of window windowtitle
        click checkbox "Shrink report to fit page width" of tab group 1 of sheet 1 of window windowtitle
        tell menu button "PDF" of sheet 1 of window windowtitle
            --menu item 2 is "Save as a PDF"
            click menu item 2 of menu 1
        end tell
    end tell
end tell

Any suggestions appreciated.

You must log in to answer this question.

Browse other questions tagged .