AppleMatters. He wrote an extensive post on how you can use TextExpander to launch applications and control them. The snippets are really simple and they really work. With a short TextExpander abbreviation, you can open or quit a program, navigate to a website, close all Finder windows, and more. While operations like Open or Quit have a built-in shortcut, the program has to be active before you can use the shortcut. These AppleScripts activate the programs for you. Best of all, you don’t have to be a true geek to use these. Bakari recommends testing the AppleScripts in Script Editor first, before pasting them into a TextExpander snippet, but this is very easy to do. 1) Open Script Editor (it’s in the AppleScript folder in Applications).
2) Paste one of Bakari’s scripts into the editor.
3) Click “Run.”
If the script did what you wanted it to do, you’re good to go. Paste it into a new TextExpander snippet (be sure to change the format to AppleScript), assign a short abbreviation, and try it out. My favorite is this one for opening up Twitter in Safari without having to be in Safari or use a bookmark:
tell application "Safari" activate open location "http://www.twitter.com/" end tell
I set the abbreviation to ‘tw (I’m using the apostrophe as a leading character in all my AppleScript snippets, and that seems to be working nicely). If you have any creative ideas for using AppleScript to control programs with TextExpander, share them in the comments.