Last active
September 24, 2020 20:23
-
-
Save mmertsock/7118c4015de294ee8af8f99d9963c16a to your computer and use it in GitHub Desktop.
AppleScript: get GitHub title and URL
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
-- For copying/pasting the title and URL of something from GitHub into an email or whatever. | |
-- output: places text into clipboard, e.g. "TitleOfPullRequest https://github.com/x/y/pull/123" | |
tell application "Safari" | |
set my_n to name of current tab of front window | |
set my_u to URL of current tab of front window | |
set my_script to "((document.title.match(/^(.*)( · Issue #| by [^ ]+ · Pull Request)/) || [])[1] || document.title)+ ' ' + document.location.href;" | |
set my_t to (do JavaScript my_script in current tab of front window) | |
set the clipboard to my_t | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment