TextExpander Snippet Runs Shell Script To Get Info About Your Mac

By

cult_logo_featured_image_missing_default1920x1080

There are a handful of apps that I have to have on every Mac I use, or things quickly start to get annoying. Launchbar is one. Dropbox is another, and TextExpander is one more. TextExpander is sold as a way to expand a short string of text into a longer string of text, so I can just type, say, “aadd” and my address magically appears. I use it all day long on both Mac and iOS for adding Markdown and HTML code to my Cult of Mac posts, and even to the the name Cult of Mac (shortcut: ccom).

But there’s a lot more in there, as this example will show. BEcause TextExpander can run scripts, it can query all kinds of neat stuff — including finding out about your Mac.

This fantastic hack comes from Matthew Janssen aka. Popple. What it does is use various shell scripts to query your Mac about its model, OS version, processor and so on. Popple’s snippet is actually a pack of scripts which are all called by this master script:

Model: %snippet:modelid%
OS Version: %snippet:sysvers%
Processor: %snippet:procspd% %snippet:procname%
Graphics: %snippet:grchip% %snippet:grvram%
Storage: %snippet:stormedia%
Memory: %snippet:mmemory%

Don’t worry, though: you just have to download his linked TextExpander file and import it. Then, whenever you type “compinfo”, it will run and print the result in your text editor’s window, thusly:

Model: iMac11,3
OS Version: OS X 10.8.2 (12C60)
Processor: 3.2 GHz Intel Core i3
Graphics: ATI Radeon HD 5670 512 MB
Storage: 
Memory: 8 GB

I think it’s getting confused about my storage as I boot from an SSD sat inside bay previously occupied by the DVD drive.

The beauty of making it dynamic script like this is that it will work on any Mac. Sure, you could copy and past this info into a static snippet, but then you’d have to change it for every computer. Or every time you made an upgrade. And best of all; TextExpander syncs between all your machines using Dropbox, do you only need to add it once. Now, I’m going to see what happens if I run it on my iPad. I’m pretty sure it’ll blow up. Or at least I might see some sparks.

Source: Popple

Newsletters

Daily round-ups or a weekly refresher, straight from Cult of Mac to your inbox.

  • The Weekender

    The week's best Apple news, reviews and how-tos from Cult of Mac, every Saturday morning. Our readers say: "Thank you guys for always posting cool stuff" -- Vaughn Nevins. "Very informative" -- Kenly Xavier.