I want to script the "Preview" application to do the equivalent of clicking the + or - button in the app, which when hovered over give the text "Scale document up" (and down). Is this possible?
More generally though, is there a way to see what events an application listens to that can be osascript "told"? In other words, what are all valid values of 'x' below for a given application "App"?
osascript -e 'tell application "App" to x'
Answering just the more general question:
osascriptis AppleScript. AppleScript commands come from the Dictionary in the target application. Load the target application's Dictionary into Script Editor (or Script Debugger) to see what they are.Returning now to the specific question:
No. The Preview application is not scriptable in any useful sense (beyond basic things like "I've got a window"). You would need to script SystemEvents to choose the Zoom In / Zoom Out menu item for you (or to send the corresponding keyboard shortcut). Here's a script, suitable for running in Script Editor, that demonstrates:
You'd need to adapt that for use in
osascript.