Re: System Profiler dictionary in 10.3?
Re: System Profiler dictionary in 10.3?
- Subject: Re: System Profiler dictionary in 10.3?
- From: Chris Garaffa <email@hidden>
- Date: Sat, 24 Jan 2004 03:00:46 -0500
On Jan 24, 2004, at 1:30 AM, Waldrip, Chris wrote:
I'm trying to write a script, in Panther, that copies the Serial
Number from the System Profiler and pastes it into the Computer Name
in the Sharing preference pane.
It seemed simple, until I figured out that neither the System Profiler
nor the System Preferences were recordable (at least actions aren't
recorded when I try it using the ScriptEditor). I'm new to
AppleScripting, but figured I could at worse look at the dictionaries
for the two applications and find examples on the web. But there are
no unique dictionary settings for the System Profiler in 10.3.
I've tried the examples for the System Profiler found in AppleScript
in a Nutshell, but they're all for 10.2.
While I'd be ever so grateful for a prewritten script (*grin*), I'd be
happy with information on how to at least get started.
Thanks in advance for any help or suggestions...
Hi Chris,
Well, I don't have any experience with scripting the System Profiler
GUI app, but there is a command line tool "system_profiler" that you
can use. Here's one line of AppleScript that will do what you want (and
I'm sure there are other ways, but this is what came to mind):
third word of (do shell script ("system_profiler SPHardwareDataType |
grep \"Serial Number\""))
What it does is run the system_profiler command, requesting hardware
data only. This is then passed to grep, which returns only lines
containing "Serial Number". The line looks something like:
Serial Number: UV302055MRT
so the third word is the serial itself.
For more information on system_profiler, check out the man page.
Information on available data types can be had by using system_profiler
-listDataTypes in the terminal. Hopefully this helps!
--
Chris Garaffa
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.