-
-
Save tekacs/996f0c22b58f36bbec61c8214e984ae9 to your computer and use it in GitHub Desktop.
This file contains 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
use AppleScript version "2.4" -- Yosemite (10.10) or later | |
use scripting additions | |
-- Back up clipboard contents: | |
set savedClipboard to the clipboard | |
tell application "SideNotes" | |
activate | |
delay 0.25 | |
tell application "System Events" to keystroke "a" using {command down} | |
tell application "System Events" to keystroke "c" using {command down} | |
tell application "System Events" to key code 124 | |
end tell | |
set theSelectedText to the clipboard | |
set AppleScript's text item delimiters to {ASCII character 13} -- take \r | |
set tstList to text items of theSelectedText | |
set AppleScript's text item delimiters to {ASCII character 10} -- and turn it into \n | |
set theSelectedText to (tstList as text) | |
-- Restore clipboard: | |
set the clipboard to savedClipboard | |
tell application "SideNotes" | |
repeat with f in folders | |
repeat with n in (get note in f) | |
set t to text of n | |
if t is equal to theSelectedText then | |
return "hook://sidenotes/" & (id of f) & "/" & (id of n) | |
end if | |
end repeat | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment