Re: Computer Serial Number
Re: Computer Serial Number
- Subject: Re: Computer Serial Number
- From: "John C. Welch" <email@hidden>
- Date: Thu, 24 Jul 2008 22:12:10 -0400
- Thread-topic: Computer Serial Number
Title: Re: Computer Serial Number
On 7/24/08 8:34 PM, "Michael J. Vinca" <email@hidden> wrote:
I was thinking more along the lines of: <http://www.vinca.ws/>
on getSerialNumber()
return word 3 of paragraph 1 of (do shell script "system_profiler | grep 'Serial Number:'")
end getSerialNumber
<http://www.vinca.ws/> But your way doesn't assume that the hardware data shows up first, so it is better. :) Although I think it is a pretty safe assumption in this case.
The short fast way:
set theSerialNumber to the last word of (do shell script "/usr/sbin/system_profiler SPHardwareDataType|grep \"Serial Number\"")
SPHardwareDataType returns less than 20 lines, as in this example from my MBP:
blackbird:~ jwelch$ system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro4,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.5 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 6 MB
Memory: 4 GB
Bus Speed: 800 MHz
Boot ROM Version: MBP41.00C1.B03
SMC Version: 1.28f1
Serial Number: W88132ASYP4
Sudden Motion Sensor:
State: Enabled
So it’s a bit faster, and there’s no duplicate data to deal with.
--
"Where there's a Will, there's usually a large, barrel-chested robot waving arms hither and thither, screaming pronouncements of doom. It's quite annoying."
>From the sig of an Outlook Express Beta Tester :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden