0

Preview shows the currently opened document’s name in its title bar. When hovering over this name, a arrow appears at the right. After a click, there is a dialogue where you can chance the file name, the file tags, the directory and set the file as protected. This is quite handy if you want to add a tag without opening the file's preferences from the Finder view.

How can I open this dialogue using keyboard shortcuts?

Thanks for help.

  • Not a real answer, but since you mentioned adding tags, you can create a keyboard shortcut to open the Tagging Menu in Finder, see here. – thee Jan 20 '15 at 13:34
  • @thee I have a similar shortcut, but I'd have to leave Preview. – lejonet Jan 20 '15 at 13:48
2

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.

  • 1) Thanks for offering this hint! 2) Can this be sped up? From hitting the shortcut until execution this takes ~2.5secs for me on a rMBP 2014 with OS X 10.9.5 and MouseTools v0.5 (built: 2010-07-31). The menu bar flashes immediately, then there's a delay for 2 secs, then 0.5 for the pop-up animation (avoidable possibly only through other GUI config hack). I want to bring that 2 sec delay down to a few ms. MouseTools in CLI (Terminal) reacts fast, so I suppose Automator/Applescript causes the slowdown. – porg Apr 23 '15 at 10:27
  • If execution of this keyboard shortcut takes 2-3 seconds, than I'm not faster than using the mouse/trackpad. Below 1 second would be my acceptance benchmark in order to prefer the keyboard shortcut over mouse/trackpad. – porg Apr 23 '15 at 10:31
  • @porg Try to remove delay 1 line in the AppleScript I posted. It waits 1s for Preview activation. – Mateusz Szlosek Apr 23 '15 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .