Puoi utilizzare Automator / Apple Script per questo con Mouse Tools per l'app della riga di comando.
Puoi ottenere Strumenti mouse da qui . È un piccolo strumento per spostare il puntatore del mouse ed eseguire i clic.
[-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
Quindi crea un flusso di lavoro Automator come servizio. Imposta "Nessun input" come input e "Anteprima" come applicazione. Aggiungi questo Apple Script lì:
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 questo caso, il mio binario MouseTools si trova nella directory Downloads
.
Salvalo e dagli un nome Ricorderai. Assegna la scorciatoia da tastiera a questo servizio in Preferenze.app in Tastiera - > Scelte rapide .
Ho provato questo e funziona per me.