Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A set of TextExpander snippets for getting and transforming the URLs of current browser pages.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
1surl
1url
2surl
2url
3surl
3url
4surl
4url
500
5surl
5url
6surl
6url
README.md
escapeurl
flickr
furl
psurl
surl

README.md

These are the TextExpander snippets I use to capture the URLs of pages I'm browsing and, in some cases, transform them. They use either AppleScript directly or Python with the appscript library and work with both Safari and Google Chrome.

The multibrowser logic works this way:

  1. If Safari is running, regardless of whether Chrome is running, get the URL from Safari.
  2. If Chrome is running, and Safari isn't, get the URL from Chrome.

furl

This is an AppleScript snippet that prints the URL of the frontmost tab of the frontmost browser window ("furl" = "front URL"). I use the abbreviation ;furl to invoke it.

The original version of this snippet (written for TypeIt4Me) is described here. I carried it along when I switched to TextExpander, then generalized it to handle both Chrome and Safari here.

1url – 6url

These are AppleScript snippets that print the URL of the nth tab, counting from the left, of the frontmost browser window. I use the abbreviations ;1url through ;6url to invoke them.

These expansions of ;furl were first described here and generalized to work with Chrome and Safari here.

surl

This is an AppleScript snippet that prints the shortened URL of the frontmost tab of the frontmost browser window ("surl" = "shortened URL"). It uses the Metamark shortening API, which requires special characters in the input URL to be encoded. The escapeurl script, included in the repository, is called by snippet to do the encoding. I use the abbreviation ;surl to invoke it.

Like ;furl this was first written for TypeIt4Me and described here, then generalized to work with Chrome and Safari here.

1surl – 6surl

These are AppleScript snippets that print the shortened URLs of the nth tab, counting from the left, of the frontmost browser window. It uses the Metamark shortening API, which requires special characters in the input URL to be encoded. The escapeurl script, included in the repository, is called by snippet to do the encoding. I use the abbreviations ;1surl through ;6surl to invoke them.

These snippets were first described here.

psurl

This is an AppleScript snippet that prints the shortened URL of the frontmost tab of the frontmost browser window in parentheses. It uses the Metamark shortening API, which requires special characters in the input URL to be encoded. The escapeurl script, included in the repository, is called by snippet to do the encoding. I use the abbreviation (;surl to invoke it.

This snippet was born out of frustration. I often put shortened URLs in parentheses in tweets, and I found myself—because TextExpander insisted on it—invoking ;surl and then going back to put in the parentheses. This snippet made thing go much faster.

This snippet was first described here.

flickr

This is a shell script snippet written in Python/appscript. It prints the "flic.kr" shortened URL for the Flickr photo in the frontmost tab of the frontmost browser window. I use the abbreviation ;flickr to invoke it.

This snippet was first described here.

500

This is a shell script snippet written in Python/appscript. It prints the URL of the smaller medium-sized version (the one that's 500 pixels wide if landscape) of the Flickr photo in frontmost tab of the frontmost browser window. I use the abbreviation ;500 to invoke it.

This snippet was first described here, then improved to handle more Flickr pages here.

Note: The appscript library isn't part of the standard distribution, and you won't be able to use the Flickr snippets unless you install it, which will also require (I think) the installation of Apple's developer tools.

Something went wrong with that request. Please try again.