Last active
October 26, 2018 22:50
-
-
Save iandol/c8fdd7884379adb8c2db to your computer and use it in GitHub Desktop.
Applescripts that ease integration of Bookends reference manager (http://www.sonnysoftware.com) with other applications. They take selected text in any application and paste it into Bookends Pubmed browser, Live-Search, and unique ID search respectively. So you can, for example, find a ref like (Hubel and Wiesel, 1962), select it, search for [Hu…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run | |
tell application "System Events" | |
keystroke "c" using command down | |
delay 0.5 | |
do shell script "id=$(pbpaste); open \"bookends://sonnysoftware.com/$id\"" | |
end tell | |
end run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run | |
tell application "System Events" | |
keystroke "c" using command down | |
tell application "Bookends" | |
activate | |
delay 0.1 | |
end tell | |
tell application "System Events" | |
keystroke "w" using {command down, shift down} | |
delay 0.75 | |
keystroke "v" using command down | |
--keystroke return --uncomment this if you want to search immediately (I prefer to edit text to improve pubmed search) | |
end tell | |
end tell | |
end run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run | |
tell application "System Events" | |
keystroke "c" using command down | |
delay 0.1 | |
--we use sed to remove ( ) , . ; @ and et al and uniqueID from a formatted ref and copy it back to clipboard | |
do shell script "pbpaste | sed -Ee 's/ et al//g' -e 's/ and//g' -e 's/[\\{\\}\\(\\),\\.;]//g' -e 's/#[0-9]+//g' -e 's/@//g' | pbcopy" | |
delay 0.1 | |
tell application "Bookends" | |
activate | |
delay 0.1 | |
end tell | |
tell application "System Events" | |
keystroke "f" using {command down, option down} | |
delay 0.5 | |
keystroke "v" using command down | |
keystroke return --comment this out if you want to edit text before search | |
end tell | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment