Why does the script below, which works with the Open and Close commands in the same menu, for example, fail at the same level with the “Save As…” item?
Substitute “New from Clipboard” or “Close” for example, in place of “Save As…” and it works fine. But “Save As…”? Can’t get it.
I want to batch a number of saves through Preview but I can’t even get to the dialog. Thanks for any help.
tell application "System Events"
tell process "Preview"
set frontmost to true
delay 2
click menu item "Save As..." of menu 1 of menu bar item "File" of menu bar 1
end tell
end tell
a very common misunderstanding
The dots are not just dots, it’s a single character called horizontal ellipsis (option semicolon on a US keyboard)
I prefer this syntax:
activate application "Preview"
tell application "System Events"
tell process "Preview"
click menu item "Save As." of menu 1 of menu bar item "File" of menu bar 1
end tell
end tell
The answer (to myself) is to click item 7. I’d still like to know if there’s a way to use naming when there’s an ellipsis. I notice “Open…” and Import Image…" don’t work either.
activate application "Preview"
tell application "System Events"
tell process "Preview"
click (get 1st menu item of menu 1 of menu bar item "File" of menu bar 1 whose name begins with "Open")
end tell
end tell
I Still can’t click the “Save” button n the dialog.
Here’s another way into the “Save As…” dialog, but how do I then click the Save button in the dialog?
Thanks for the help!
tell application “Preview”
activate
end tell
tell application “System Events”
tell process “Preview”
tell menu bar 1
tell menu bar item “File”
tell menu “File”
click menu item 9
click button “Save” of window “Untitled”
end tell
end tell
end tell
end tell
end tell
activate application "Preview"
tell application "System Events"
tell process "Preview"
click menu item "Save As." of menu 1 of menu bar item "File" of menu bar 1
repeat until exists sheet 1 of window 1
delay 0.5
end repeat
click button "Save" of sheet 1 of window 1
end tell
end tell
activate application "Preview"
tell application "System Events"
tell process "Preview"
click menu item "Save As." of menu 1 of menu bar item "File" of menu bar 1
repeat until exists sheet 1 of window 1
delay 0.5
end repeat
tell sheet 1 of window 1
set focused of text field 1 to true
keystroke "newName" -- text field name
set value of slider 1 of group 1 to 0.2 -- (Qualitiy slider, values from 0.0 to 1.0)
click button "Save"
end tell
end tell
end tell