Skip to content

Instantly share code, notes, and snippets.

@cpjhenry
Created May 26, 2016 12:57
Show Gist options
  • Save cpjhenry/1527dd803b33a2e24e403ca400fe3446 to your computer and use it in GitHub Desktop.
Save cpjhenry/1527dd803b33a2e24e403ca400fe3446 to your computer and use it in GitHub Desktop.
AppleScript to send current url from Google Chrome to nvAlt
on run {input, parameters}
tell application "Google Chrome"
set noteTitle to get title of active tab of first window
set noteURL to get URL of active tab of first window
display dialog "Set title:" with title "Send to nvAlt" default answer noteTitle
set noteTitle to the text returned of the result
display dialog "Enter a comment:" default answer ""
set noteComment to the text returned of the result
if noteComment is not "" then set noteComment to noteComment
set NoteBody to noteURL & "
" & noteComment
end tell
tell application "nvALT"
activate
search noteTitle
tell application "System Events"
keystroke return
set the clipboard to NoteBody
key code 9 using {command down} -- Command+v
key code 53
set visible of process "nvALT" to false
end tell
end tell
# display alert "Note Added"
display notification "\"" & noteTitle & "\" sent to nvALT." with title "Google Chrome"
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment