Chrome TextExpander Snippets
Using TextExpander and AppleScript, I can easily get the current URL of the Chrome browser. This is useful when I want to share the URL in an email, Slack or a blog post.
Simple setup to get the URL in TextExpander
I have two Snippets setup, one to get the URL and one to get the title of the page:
tell application "Google Chrome" set theURL to URL of active tab of window 1 end tell
Defined as: snippet:chrome.full.url
tell application "Google Chrome" set theTitle to TITLE of active tab of window 1 end tell
Defined as: snippet:chrome.title
Chrome Link with the Title
Very useful when the page title is suitable for a link:
<a href="%snippet:chrome.full.url%">%snippet:chrome.title%</a>
Just the Chrome Link
Create the anchor tag with the Chrome URL and put the cursor where I can enter in the link text
<a href="%snippet:chrome.full.url%">%|</a>
Chrome Url with Clipboard Text
Create a link to the site using the content of the clipboard as the link text
<a href="%snippet:chrome.full.url%">%clipboard</a>
Rich Text Format
I created a rich text snippet for email and Word Document
Technical Notes
As you can see, it's really handy to have a couple of base snippets that are being used by other snippets.
In addition, if Apple or Chrome should change the Javascript functionality, I'll only have to change it in one place.