Last active
October 21, 2016 00:19
-
-
Save cpjhenry/7919bb6e0a40fdfe2a76f9b6ddff8cfd to your computer and use it in GitHub Desktop.
AppleScript to send current url from Google Chrome to Mac Notes
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 {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 | |
if noteTitle is "" then | |
display dialog "Enter a title for the new note:" ¬ | |
with title "Send to Notes" ¬ | |
default answer "Untitled note" | |
set noteTitle to the text returned of the result | |
end if | |
display dialog "Enter a comment for the new note:" ¬ | |
with title "Send to Notes" ¬ | |
default answer "" | |
set noteComment to the text returned of the result | |
if noteComment is not "" then set noteComment to "<br><br>" & noteComment | |
set NoteBody to "<a href=\"" & noteURL & "\">" & noteURL & "</a>" & noteComment | |
end tell | |
tell application "Notes" | |
# activate | |
set thisAccountName to "iCloud" | |
set folderName to "Notes" | |
tell account thisAccountName | |
make new note at folder folderName ¬ | |
with properties {name:noteTitle, body:NoteBody} | |
end tell | |
end tell | |
display notification "Sent \"" & noteTitle & "\" to Notes..." 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