Created
May 13, 2020 14:48
-
-
Save evantravers/caca9613a65119082b4e390ad8b8f5f0 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
-- 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