Skip to content

Instantly share code, notes, and snippets.

@evantravers
Created May 13, 2020 14:48
Show Gist options
  • Save evantravers/caca9613a65119082b4e390ad8b8f5f0 to your computer and use it in GitHub Desktop.
Save evantravers/caca9613a65119082b4e390ad8b8f5f0 to your computer and use it in GitHub Desktop.
-- stolen from: https://gist.github.com/gabeanzelini/1931128eb233b0da8f51a8d165b418fa
if (count of theSelectionFromBrave()) is greater than 0 then
set str to "tags: #link
" & theTitleFromBrave() & "
> " & theSelectionFromBrave() & "
[" & theTitleFromBrave() & "](" & theCurrentUrlInBrave() & ")"
tell application "Drafts"
make new draft with properties {content:str, tags: {"link"}}
end tell
end if
on theCurrentUrlInBrave()
tell application "Brave Browser" to get the URL of the active tab in the first window
end theCurrentUrlInBrave
on theSelectionFromBrave()
tell application "Brave Browser" to execute front window's active tab javascript "getSelection().toString();"
end theSelectionFromBrave
on theTitleFromBrave()
tell application "Brave Browser" to get the title of the active tab in the first window
end theTitleFromBrave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment