Text Expansion: System & Hardware Info

This tiny text expansion macro will insert the computer’s system and hardware info, as typically required for bug reports or support tickets.

The preset text trigger is ;sysinfo

This will insert a minimal system info, like this:

Model Identifier: Macmini6,2
System Version: OS X 10.11.4 (15E65)


If you type ;Sysinfo it will insert a more verbose system info:

Model Identifier: Macmini6,2
Memory: 16 GB
Boot ROM Version: MM61.0106.B0A
SMC Version (system): 2.8f0
System Version: OS X 10.11.4 (15E65)
Kernel Version: Darwin 15.4.0
System Integrity Protection: Enabled


Finally, typing ;sYsinfo will produce this:

Model Name: Mac mini
Model Identifier: Macmini6,2
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 4
Memory: 16 GB
Boot ROM Version: MM61.0106.B0A
SMC Version (system): 2.8f0
Chipset Model: Intel HD Graphics 4000
VRAM (Dynamic, Max): 1536 MB
System Version: OS X 10.11.4 (15E65)
Kernel Version: Darwin 15.4.0
System Integrity Protection: Enabled
Time since boot: 8 days 46 minutes


Sorry, this time no fancy HTML prompt :wink:

System and Hardware Info.kmmacros (11.4 KB)


7 Likes

Very nice, @Tom! :+1:

I can make good use of this.
To minimize typing and provide a memory aid, I use these as text triggers:

;si
;si.med 
;si.max

Since 99% of the time I want the minimum info, I just set the first trigger to ;si

I also add a space at the end of each so that it is not triggered until I hit the SPACE key.

Here are the minor changes I made to @Tom's macro:

Nice to hear that it is useful!

Don’t know if you’ve seen it, in the “Resources” group at the beginning of the macro you have some scripts that show you the unfiltered output of SPSoftwareDataType, SPHardwareDataType and SPDisplaysDataType. This may help to quickly compose a custom info set.


Ah, I see, I forgot to explain the mnemonics for my abbreviations :wink:

Basic level: all lowercase
1st escalation: 1st character uppercase
2nd escalation: 2nd character uppercase


BTW, for your modified triggers no regex matching is needed. This…

should do the trick.

I saw them. They just don't work for me as memory aids. :wink:

True, but what I have is tested and works fine. :wink:

Thanks.

To produce a somewhat easier to read table:

system_profiler SPHardwareDataType SPDisplaysDataType SPSoftwareDataType | grep -E "Model|Version|Processor|Cores|Memory: \d|VRAM|Integrity|Time" | sed -E 's!^ *!!; s!([^0-9]): !\1•:•!' | column -t -s'•'
Model Name                    :  MacBook Pro
Model Identifier              :  MacBookPro6,1
Processor Name                :  Intel Core i7
Processor Speed               :  2.66 GHz
Number of Processors          :  1
Total Number of Cores         :  2
Processor Interconnect Speed  :  4.8 GT/s
Boot ROM Version              :  MBP61.0057.B11
SMC Version (system)          :  1.57f18
Chipset Model                 :  Intel HD Graphics
VRAM (Dynamic, Max)           :  288 MB
gMux Version                  :  1.9.22
Chipset Model                 :  NVIDIA GeForce GT 330M
VRAM (Total)                  :  512 MB
gMux Version                  :  1.9.22
System Version                :  OS X 10.11.4 (15E65)
Kernel Version                :  Darwin 15.4.0
System Integrity Protection   :  Enabled
Time since boot               :  2 days 20:45

-Chris

2 Likes

In a (theoretical) world of monospace, yes :wink:

Nothing is perfect, but Chris' output is still very readable in a proportional-space font.

2 Likes

Sure.

Highly useful! Thanks.

To expand @ccstone’s contribution to format as a table, here is how you can specify a mono-spaced font for pasting into other applications. @Tom, this might help with the email showing in a proportional-spaced font, but it actually depends on the email program.

Append the following code to the end of Chris’ command. It will take the columnized output, convert into Rich Text Format with your desired font, then puts it onto the clipboard.

| textutil -convert rtf -font 'Courier New' -stdin -stdout | pbcopy

By default it will be in font size 12. If you want a different size, add the -fontsize argument and your desired size. For example,

| textutil -convert rtf -font 'Courier New' -fontsize 18 -stdin -stdout | pbcopy

Hope this helps.

5 Likes

Well done Onan!   :smile:

-Chris

2 Likes

I tested this, and also the KM-native RTFing action, but it doesn’t work if you have plain text fields (for example a new Mail message set to plain text, or any document in BBedit, etc.)

This means that you have to have two macros, one for plain, one for rich text. (Or a “if then” clause).

So, while these table-styling approaches are very nice, they are not robust at all. I still think that the vanilla approach is the most convenient.

Hey Tom,

Sure enough. I'm shocked the RTF emplaced on the clipboard with pbcopy won't paste as plain text where appropriate. That's very un-Mac-like.

I'm fairly sure it's possible to put more than 1 text flavor on the clipboard using ASObjC, but I don't have time to look into it at the moment.

On the other hand there's an easy fix using Keyboard Maestro:
(Retains format for both Plain Text and Rich Text documents)

System Information v1.02.kmmacros (4.1 KB)

This macro emplaces text appropriately in every venue tested so far.

-Chris

[ EDITED 2016/04/22 14:33 CST – minor improvements to macro ]

3 Likes

Chris, thanks for sharing.
So, to make sure I understand, your macro puts BOTH plain text and rich text on the Clipboard, right?

Yes. Give it a try.  :smile:

-Chris

The pasteboard will send the contents back in whatever format the application is asking for, if it is supported (ie you can't paste an image into a plain text document)

[quote="ccstone, post:13, topic:3337"]I'm shocked the RTF won't paste as plain text where appropriate
[/quote]

When it wasn't working for you, did you get the raw RTF code? If so, that is bad. It could mean the pboard service has failed. A reboot is usually required. Here is a good write-up of the issue.

After sending to the pasteboard, switch to the Finder and select Edit>Show Clipboard. It should show formatted text and at the bottom it should say the contents are RTF.

I tested both versions and the text was on the clipboard as RTF. Here are some quick results.

  • In TextEdit with a Rich Text document, it pasted as formatted RTF text. :thumbsup:
  • In BBEdit, it pasted as plain text. :thumbsup:
  • In Chrome, composing an email message in Gmail, it pasted wrong. It was Sans Serif text and padding added between each line, as if they were paragraphs. :thumbsdown:
  • If I ran cat file.rtf | pbcopy, I had mixed results. Sometimes it would paste RTF but other times it would not paste anything and then the Paste option stopped working as if the clipboard was empty or contained something it couldn't accept, but only for that app until I quit/restarted it. :thinking:

tl;dr:
After more testing and research, I've determined that the pbcopy/pbpaste utilities are flaky and probably shouldn't be used if possible. I would recommend removing the | pbcopy from the script and have KM save it directly to the clipboard.

2 Likes

Hey Onan,

No.

If you run this:

echo "Nuts!" | pbcopy; sleep 0.25;
system_profiler SPHardwareDataType SPDisplaysDataType SPSoftwareDataType | grep -E "Model|Version|Processor|Cores|Memory: \d|VRAM|Integrity|Time" | sed -E 's!^ *!!; s!([^0-9]): !\1•:•!' | column -t -s'•' | textutil -convert rtf -font 'Menlo' -fontsize 14 -stdin -stdout | pbcopy;

“Nuts!” will paste into BBEdit, but the full sysinfo text will paste into TextEdit.

So, something is odd indeed...

You're right – pbcopy isn't needed in my macro above. I'll fix that shortly.

-Chris

Thanks, Chris. I had tried this before, too (that’s what i meant with “KM-native RTFing action”) and now I literally spent half an hour to find out why yours is working while mine is not. And the thing was…

…I’ve simply forgot to append the paste action :face_with_head_bandage::astonished:

2 posts were split to a new topic: Paste System Info (min, med, or max)

Hey Tom,

PEBKAC is always annoying.

One of my repeat offenders is forgetting to turn on regular expressions in a search/replace action.

-Chris

2 Likes