0

After updating to Ventura my applescipt stopped working. I am trying to press the PDF button in numbers print menu. Code is below. Seems like the group line is the issue but can't seem to get it to work

Here is the code I tried

on run {input, parameters}  
    tell application "Numbers"
        activate
        
        --goes to print dialog box--
        tell application "System Events"
            keystroke "p" using command down
            delay 0.5
            keystroke "p" using command down
            delay 0.5
            
            
            --saves PDF to location--
            tell application process "Numbers"
                tell window 1
                    tell sheet 1
                        tell splitter group 1
                            tell group 1
                                delay 0.5
                                click button "PDF"
                                delay 1
                            end tell
                        end tell
                    end tell
                end tell
            end tell
        end tell
    end tell
    
    return input
end run

1 Answers1

0

Apple changed the structure of the Print dialog in Ventura. Substitute this code in middle your original script:

...
tell splitter group 1
    tell group 2 -- for Ventura
        tell menu button 1 -- for Ventura
            click
            delay 1.0
            click menu item "Save as PDF…" of menu 1
        end tell
    end tell
end tell
...

The button in now a "menu button" and it is in group 2, not group 1. The script must click it, delay long enough for the underlying menu to be dynamically created, and then click the actual menu item. This will then display the dialog box for Saving as PDF.

Ron Reuter
  • 1,287
  • 1
  • 8
  • 14