|February 17, 2016|
Sometimes when doing some work on my computer I need some computer information and that's what this week's post is all about - getting information when you need it and fast!
If you do any object oriented programming you know about using the word 'this' as a variable. Objects have a notion of "this" or "self." I decided to build on that to build today's abbreviation. I set up the abbreviation to prefix with "this." so that I can remember it a bit easier.
Getting the System Version
Every once in a while I forget which OS version I am using. I get lost in the marketing name (OS X El Capitan) and forget that I am using 10.11.3. I created a snippet with the following code:
set os_version to do shell script "sw_vers -productVersion"
Getting the Computer Identification
I know that I am using an iMac, that's pretty obvious. However, on occasions, I forget the identification of the iMac that I have. To get that information I have to resort getting that from the "About Mac." I thought there must be a way the TextExpander can make this easy.
This comes in handy when I am looking for various accessories for my computer and need to know if it will work. Nothing like buying a cool USB3 device only to find out that your computer doesn't have any USB3 ports to take advantage of the high USB speed.
Credit for this AppleScript code goes to cirno over at macscripter.net. This is the Applescript code that I used:
set macmodel to my getmacmodel() on getmacmodel() set macmodel to missing value set command to "system_profiler SPHardwareDataType" set paras to paragraphs of (do shell script command) repeat with para in paras if para contains "Model Identifier:" then set colonoffset to offset of ":" in para set macmodel to (characters (colonoffset + 2) through -1 of para) as text exit repeat end if end repeat return macmodel end getmacmodel
These are some basic TextExpander snippets that can be handy when you need them. That's why I recommend doing a simple abbreviation such as 'this.system' and 'this.computer' to remember the functionality.
Hope this inspires you to come up with other creative TextExpander snippets!
Add your Comments
Feel free to leave a comment about this post.