|December 23, 2015|
Displaying the Browser URL
The ability to run AppleScript from TextExpander is win win situation. Here's another cool snippet using AppleScript that I think you'll enjoy:
Let's say that I find a great article on Boston.com that mentions the company that I use to work at. I decide to share some of the content to a former co-worker. So, I cut and paste the relevant text from the browser and compose a new email message with that text. Now if I want to include the URL, I would have to go back to the browser and copy the URL and then paste it in the email.
With TextExpander and some very basic AppleScript I don't have to go back anymore! I created a snippet to get the URL of the browser. Since I have multiple browsers on my computer I have a couple of snippet setup.
Here's a sample code for Chrome, don't forget to set the Content to AppleScript:
tell application "Google Chrome" set theURL to URL of active tab of window 1 end tell
The abbreviation that I assigned the task is very easy to remember: chrome.url and safari.url
Now where ever I want to share the URL of the page I am looking at, I just need to remember what browser I used.
What about Firefox?
Apparently Firefox removed the ability to use AppleScript in the latest version due to some technical reasons.
You can read all about the latest Apple/Firefox drama in Bug 516502 "Re-add AppleScript support for getting the current URL" bug report.
Add your Comments
Feel free to leave a comment about this post.