How to evoke Preview's title bar saving dialogue by shortcut?
Solution 1:
You can use Automator/Apple Script for this with Mouse Tools command line app.
You can get Mouse Tools from here. It's a small tool to move mouse pointer and perform clicks.
[-h] return this help text
[-b] coordinates are measured from bottom-left corner of the screen
[-location] return the current mouse location
[-x "xValue" -y "yValue"] move the mouse to the {xValue, yValue} location
[-mouseSteps numSteps] move mouse in number-of-steps to the location
[-leftClick] perform a mouse left-click at the current mouse location
[-doubleLeftClick] perform a mouse double-click with the left mouse button
[-rightClick] perform a mouse right-click at the current mouse location
[-shiftKey] shift key down, useful when performing a left-click event
[-commandKey] command key down, useful when performing a left-click event
[-optionKey] option key down, useful when performing a left-click event
[-controlKey] control key down, useful when performing a left-click event
[-leftClickNoRelease] perform a mouse click and do not release the mouse click
[-releaseMouse] release the mouse after using -leftClickNoRelease
Then create an Automator workflow as a Service. Set "No input" as an input and "Preview" as an application. Add this Apple Script there:
on run {input, parameters}
tell application "Preview" to activate
delay 1
set mouseToolsPath to (path to home folder as text) & "Downloads:MouseTools"
tell application "Preview"
set _b to bounds of the front window
set _x to item 1 of _b
set _y to item 2 of _b
set _width to item 3 of _b
end tell
set xpos to _x + (_width / 2)
set ypos to _y + 10
do shell script quoted form of POSIX path of mouseToolsPath & " -x " & (xpos as text) & " -y " & (ypos as text)
do shell script quoted form of POSIX path of mouseToolsPath & " -leftClick"
return input
end run
In this case, my MouseTools binary is in Downloads
directory.
Save it and give it a name You'll remember. Assign keyboard shortcut to this Serivce in Preferences.app under Keyboard -> Shortcuts.
I tested this and it works for me.