Jump to content

Request: About this Mac


Recommended Posts

I posted to the Apple forums, requesting a foolproof way of getting the link to the support/specification site for each model ... no responses yet. I'm starting to think perhaps I may have to remove the links (that functionality) in the final workflow, as it's not entirely universal, and requires too much work to get it to work for those that are new to alfred2: I am a FIRM believer in having things "JUST WORK."

Maybe try loading the page with the 4 digit code, and if there was an error, load the page with the 3 digit code. You can then store the results of that in a cache file so it doesn't have to wait for a page request every time it runs.

Link to comment

Maybe try loading the page with the 4 digit code, and if there was an error, load the page with the 3 digit code. You can then store the results of that in a cache file so it doesn't have to wait for a page request every time it runs.

Well, as far as I know, the 3 digit code was the first. And for newer machines it's the 4 digit code. When a take my iMac 27" (Mid 2011) and only use a 3 digit code, I do not get an error, I just get the wrong machine. I SUPPOSE your proposed method might work, but again, it's a round-about way. I spent a fair bit of time trying to find any indication of how 10.8.3 might store my actual machine code for linking to the support/specifications site (which is really just a redirect) but found no stored files. One suggestion I found online was that the "SIMachineAttributes.plist" might store this info, but even my model is not listed in that correctly!

 

I'm wondering if perhaps there's a way to 'snoop' the addy when clicking on the link from the Menu "About This Mac" ... because then at least it would always be accurate.

 

OK, just found out how snippets work. IF the serial number has a total of 11 characters, then use last 3 digits. IF the serial has 12 characters, then use 4 digits. There we go ... now I just need to add that bit of text wrangling to the mix and it should work in all cases.

found info on everymac.com

Edited by RodgerWW
Link to comment

OK folks, I need you 3 digit serial folks to test this:

 

1: Open Alfred Preferences

2: Select my "About This Mac" workflow on the left.

3: Notice the two scripts in the middle between the script filter and the copy to clipboards.

4: For the top "Run Script" with the 'ctrl' modifier: double click to edit, and in the script area paste the following REPLACING the code there:

SERIAL=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print length($4)}')
if [ $SERIAL == 11 ]; then
INJECT=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print substr( $0, length($0) - 2, length($0) ) }')
else [ $SERIAL == 12 ]
INJECT=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print substr( $0, length($0) - 3, length($0) ) }')
fi
open "http://support-sp.apple.com/sp/index?page=psp&cc=$INJECT"

 

5: For the bottom "Run Script" with the 'alt' modifier: double click to edit, and in the script area paste the following REPLACING the code there:

SERIAL=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print length($4)}')
if [ $SERIAL == 11 ]; then
INJECT=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print substr( $0, length($0) - 2, length($0) ) }')
else [ $SERIAL == 12 ]
INJECT=$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print substr( $0, length($0) - 3, length($0) ) }')
fi
open "http://support-sp.apple.com/sp/index?page=cpuspec&cc=$INJECT"

I've tested this on my system and it opens the correct Apple sites in my browser, with the correct hardware! So if no one has issues with this, I will be adding this to v03.

Edited by RodgerWW
Link to comment

Thanks for the update - it's working great on my machine with 3 digit serial.

That is, after adding the missing line break before 'if' in the 'ctrl' script ;)

Having issues with the posts. I had to modify twice because the 'code' button wasn't working right. But thank you for noticing that break ... I modified the post again to correct.

Link to comment

Having issues with the posts. I had to modify twice because the 'code' button wasn't working right. But thank you for noticing that break ... I modified the post again to correct.

 

 

I'm having issues with the ctrl script. It loads the site, but not my specs.

Link to comment

I'm having issues with the ctrl script. It loads the site, but not my specs.

First: the ctrl script loads the support site for the hardware, the alt script loads the hardware specs. I checked the posted script for ctrl (because I had to modify the post twice due to posting issues) and it does load the appropriate site for my iMac (http://www.apple.com/support/imac/intel/)

 

Second: When you click on the "Hardware Support" from within the "About This Mac" in your system menu can you check to see if it's using your last 3 digits of your serial and loading the site correctly? You might have do it a couple times because it's a redirect ... but look closely for "http://support-sp.apple.com/sp/index?page=psp&cc=3digitshere〈=en_ca" type deal. My system is english Canadian so that's why mine shows en_ca.

 

Third: Does your serial number contain 11 or 12 characters?

Link to comment

First: the ctrl script loads the support site for the hardware, the alt script loads the hardware specs. I checked the posted script for ctrl (because I had to modify the post twice due to posting issues) and it does load the appropriate site for my iMac (http://www.apple.com/support/imac/intel/)

 

Second: When you click on the "Hardware Support" from within the "About This Mac" in your system menu can you check to see if it's using your last 3 digits of your serial and loading the site correctly? You might have do it a couple times because it's a redirect ... but look closely for "http://support-sp.apple.com/sp/index?page=psp&cc=3digitshere〈=en_ca" type deal. My system is english Canadian so that's why mine shows en_ca.

 

Third: Does your serial number contain 11 or 12 characters?

 

Aw, I see. It just loads the architecture not the acutal specs, It brought up that same link. 

Link to comment

OK, I think the next version is ready for test.

 

This version is outdated and the final can be found HERE.

 

[image removed]

Updates to this workflow:

1: Can show multiple graphic cards now ... well, 2

2: The links to the Apple Support/Hardware sites should now work with either 11 or 12 digit serials

3: Updated the 'Time Since Boot' to be more 'readable'

4: Updated icons in general

5: Now includes all hardware icons (machines) from 'coretypes.bundle' so you can have the correct icon for 'System'

 

Please read the readme for the workflow (double click on the "About This Mac" workflow, then select the 'Readme' tab) for changing the hardware icon. If I can make that simpler, believe me, I will.

 

I suppose this is obvious, but if anyone has issues please let me know.

Edited by RodgerWW
Link to comment

WOW This is awesome. Thanks for your great work.

Is there a way to change the "Time Since Boot" to a more, more 'readable' format?   ;)

Like x day(s), x hour(s), x minute(s) 

 

Once again thanks for this great job.

 

Well, we all have our preferences, and yes, it is quite possible with awk/sed formatting. My particular method is this portion of the script:

 

 

UPTIME=$(cat atm.txt | system_profiler SPSoftwareDataType| grep 'Time since boot' | awk '{sub(/Time since boot:/, ""); sub(":", " hours ", $3); sub("", "minutes", $4);print "" $0}'| sed -e 's/ 1 days/ 1 day/g' -e 's/ 1 hours/ 1 hour/g' -e 's/00 minutes/0 minutes/g' -e 's/01 minutes/1 minute/g' -e 's/02 minutes/2 minutes/g' -e 's/03 minutes/3 minutes/g' -e 's/04 minutes/4 minutes/g' -e 's/05 minutes/5 minutes/g' -e 's/06 minutes/6 minutes/g' -e 's/07 minutes/7 minutes/g' -e 's/08 minutes/8 minutes/g' -e 's/09 minutes/9 minutes/g') 

Futz with that command in terminal [remove the "cat atm.txt | " first] ... especially noting the "| sed" portion of the command. This is where I replace "1 hours" with "1 hour". I noticed you want the (s) beside the singular, so, you would replace, for instance "sub(":", " hours ", $3);" with "sub(":", " hour(s) ", $3);" 

Link to comment

The choice of hardware icons in V03 is nice. Now my MacBook shows up correctly.
I noticed some minor issues however:

  • Uptime shows the word 'minutes' twice, in version 2 it was displayed correctly as '35 minutes'
  • A line for the second graphics card is always displayed, even if I don't have one
  • Processor description is one word short: I have a 'Core 2 Duo' but it is displayed as 'Core 2' (in version 2 of workflow, too)

Is there some way around these quirks?

 

alfred_aboutMac.png

Link to comment

The choice of hardware icons in V03 is nice. Now my MacBook shows up correctly.

I noticed some minor issues however:

  • Uptime shows the word 'minutes' twice, in version 2 it was displayed correctly as '35 minutes'
  • A line for the second graphics card is always displayed, even if I don't have one
  • Processor description is one word short: I have a 'Core 2 Duo' but it is displayed as 'Core 2' (in version 2 of workflow, too)

Is there some way around these quirks?

 

alfred_aboutMac.png

 

K, this is the info I need, as I haven't access to such hardware! If you could please post your atm.txt, or private message me, just replace the serial number listed in the file with random numbers ... just so I can see the exact formatting in the file. If I get the file here, I can test it locally against my system setup to nail down these quirks faster.

 

I thought I nailed the multiple graphics cards / or just one ... apparently not!

For now, you can modify the script thusly:

 

1: Delete the reference to GFXSUB2= including the 6 tabbed lines under it.

2: Delete the following 2 lines:

 

   GRAPHICS2_CHIPSET=$(cat atm.txt | grep 'Chipset Model' | awk 'NR==2 {print substr($0, index($0,$3))}')
   GRAPHICS2_VRAM=$(cat atm.txt | grep 'VRAM (Total)' | awk 'NR==2 {print substr($0, index($0,$3))}' | sed 's/^/ /')
3: Delete the reference GRAPHICS_ICON2= including the 12 tabbed lines under it.
4: Delete the line graphics2UID=$(uuidgen)
5: and finally delete the item section:
   <item uid="$graphics2UID" arg="$GRAPHICS2_CHIPSET$GRAPHICS2_VRAM">
   <title>$GRAPHICS2_CHIPSET$GRAPHICS2_VRAM</title>
   <subtitle>$GFXSUB2</subtitle>
   <icon>$GRAPHICS_ICON2</icon>
   </item>

 

The minutes showing twice is most likely due to no seconds ... still, and error that needs to be 'corrected'

I looked a bit closer at the script and found a bit of an error on my part ... sloppy pasting I think.

Look at this part of the script BOLD:

 

UPTIME=$(cat atm.txt | system_profiler SPSoftwareDataType| grep 'Time since boot' | awk '{sub(/Time since boot:/, ""); sub(":", " hours ", $3); sub("", "minutes", $4);print "" $0}'| sed -e 's/ 1 days/ 1 day/g' -e 's/ 1 hours/ 1 hour/g' -e 's/00 minutes/0 minutes/g' -e 's/01 minutes/1 minute/g' -e 's/02 minutes/2 minutes/g' -e 's/03 minutes/3 minutes/g' -e 's/04 minutes/4 minutes/g' -e 's/05 minutes/5 minutes/g' -e 's/06 minutes/6 minutes/g' -e 's/07 minutes/7 minutes/g' -e 's/08 minutes/8 minutes/g' -e 's/09 minutes/9 minutes/g')

 

for SOME reason, there's "system_profiler SPSoftwareDataType|" in there, and it SHOULDN'T be, as I've already specified to read from the atm.txt with cat. Please delete that bold part ... and let me know if that aids in the time showing.

 

The processor not showing 'Duo' is definitely due to only showing 3 columns of info ... so I'll need to correct that as well.

For now you can replace the following line in the script:

 

PROC_NAME=$(cat atm.txt | grep 'Processor Name' | awk '{print $3,$4,$5}')

 

WITH

 

PROC_NAME=$(cat atm.txt | grep 'Processor Name' | awk '{print substr($0, index($0,$3))}')

 

Basically, this change is now showing everything after the 'Processor Name', instead of just showing 3 tabs.

Edited by RodgerWW
Link to comment

I've updated V03 in the post above #35 to fix some minor errors as mentioned by derico.

I modified the Processor line in the script.

I fixed the error in the UpTime portion of the script where I was both reading from the atm.txt and also bashing system_profiler.

 

STILL trying to figure out single/multiple graphics

Link to comment

Hey Rodger, thanks for the quick update and pointing out the lines regarding a second graphics card!

 

My processor is displayed correctly with the new version. Processor speed was missing due to missing 'print' keyword in line 5 of the script filter, just to let you know. Sneaky paste errors... ;)

 

I'll send the atm.txt via PN.

Edited by derico
Link to comment

Hey Rodger, thanks for the quick update and pointing out the lines regarding a second graphics card!

 

My processor is displayed correctly with the new version. Processor speed was missing due to missing 'print' keyword in line 5 of the script filter, just to let you know. Sneaky paste errors... ;)

 

I'll send the atm.txt via PN.

 

WOW, I suck at copy/paste! I swear, my eyes hurt from looking at this script for so long. I've update V03 yet again to fix the missing print in line 5.

Link to comment

Yup ... already using software/hardware/displays/memory datatypes, with a little sprinkle of other commands for easier parsing.

 

Wasn't sure. Ont he first page you were looking at ways to get that information. Figured I'd share once I figured it out. Sorry, I just personally don't have a use for the workflow so I didn't check how you were doing it. Sorry, but glad to see you have things working how you would like!

Link to comment

To follow up on the 'uptime' issue - when running for more than an hour (e.g. 3 hours and 37 minutes) it looks like this:

 

alfred_aboutMac2.png

 

The relevant line in atm.txt is:

Time since boot: 3:37
Edited by derico
Link to comment

To follow up on the 'uptime' issue - when running for more than an hour (e.g. 3 hours and 37 minutes) it looks like this:

 

alfred_aboutMac2.png

 

The relevant line in atm.txt is:

Time since boot: 3:37

 

Is it still doing this with the recent update to version 3 in post 35?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...