Skip to content

Instantly share code, notes, and snippets.

@vertesy
Last active March 1, 2019 10:51
Show Gist options
  • Save vertesy/0dda3bf36ff165739941d6abc9b50b9a to your computer and use it in GitHub Desktop.
Save vertesy/0dda3bf36ff165739941d6abc9b50b9a to your computer and use it in GitHub Desktop.
Open pdf externally from Mendeley desktop
# From http://biogeolabs.uchicago.edu/sedie/?p=4363
# After brew install cliclick
# Fixed for OS X Mojave
# Error in original: highlight does not seem to go to the context menu, thus every odd arrow-down click reveals the desktop
# Solution:
# "-- PRESS ENTER" section repeated before "-- ARROW DOWN TO MENU ITEM" to bring highlight to the context menu.
# remove one of the 4 "arrow-down" statements
# NOTE: cliclick might be installed elsewhere than: /usr/local/Cellar/cliclick/4.0.1/bin/cliclick
# Use code below, thank the original author.
on run {input, parameters}
tell application "Mendeley Desktop" to activate
-- USING CLICLICK
-- -r returns mouse to original position
-- w: is the wait time between clicks
-- c: the coordinates - note that the y coordinate is 900 - GRAB value
-- click the prefs button
-- RIGHT CLICK AT THE CURRENT MOUSE POSITION
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick kd:ctrl w:1 c:+0,+0"
-- PRESS ENTER
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick kp:return"
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick ku:ctrl"
-- ARROW DOWN TO MENU ITEM
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick kp:arrow-down w:1"
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick kp:arrow-down w:1"
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick kp:arrow-down w:1"
-- PRESS ENTER
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick kp:return"
do shell script "/usr/local/Cellar/cliclick/4.0.1/bin/cliclick ku:ctrl"
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment