Advertisement

How to use TextExpander to grab your location and enter it into a document

Last week, Smile Software shared a great tip for using TextExpander to pull down your GPS coordinates so you can use them in any app. The snippet takes advantage of TextExpander's ability to run AppleScript when you call up the script using a TextExpander keyboard shortcut.

Before you can use the TextExpander snippet, you must download and install the Location Helper app from David Blishen. Location helper brings OS X's Core Location to AppleScript, allowing you to pull down your current location, altitude and geocode address. Location Helper is an agent that runs in the background and has no user interface.

To get TextExpander, Location Helper and AppleScript to work together nicely, here is what you need to do:

1. Download TextExpander from Smile's website or from the Mac App Store.

2. Download Location Helper for AppleScript from the Mac App Store.

3. Launch Location Helper. You need to launch it once in order to give the app permission to access your location.

4. Create a new TextExpander snippet by opening TextExpander and clicking the "+ New Snippet" button.

5. At the top of the new snippet dialog, Select "Content: Plain Text" and change it to "AppleScript."

6. In the content editor section, paste in the following AppleScript:

tell application "Location Helper"

set listCoords to get location coordinates

set clocationrecord to get location altitude

return "My coordinates are " & (item 1 of listCoords as text) & ", " & (item 2 of listCoords as text) & " and my altitude is " & (clocationrecord as text)

end tell

7. Set the abbreviation of the snippet to a keyboard shortcut of your choice. I choose ";loc" as that is easy to remember and fits into my workflow.

8. Open your favorite text editor and type your abbreviation to see how it works.

Feel free to edit your AppleScript as needed using these Location Helper examples from Blishen. If you have any other cool uses of TextExpander and AppleScript, please share them in the comments.