Re: One for the experts: Serial Number of computer using Applescript Studio
Re: One for the experts: Serial Number of computer using Applescript Studio
- Subject: Re: One for the experts: Serial Number of computer using Applescript Studio
- From: David C Andrews <email@hidden>
- Date: Fri, 18 Mar 2005 20:14:04 -0500
On Mar 18, 2005, at 7:12 AM, Neil Faiman wrote:
On Mar 18, 2005, at 4:45 AM, Andrew Oliver wrote:
On 3/18/05 1:13 AM, "Michelle Steiner" <email@hidden> wrote:
...
tell application "System Profiler"
set foo to system profile
paragraph 13 of foo
end tell
...
This might work for now, but it probably won't work when Apple change the
output of System Profiler to include more information and the Serial number
moves to line 14 or 15...
But this will work, as long as the profile contains a line with phrase "Serial Number:"
tell application "System Profiler"
set sn to ""
set sp to system profile
repeat with p in paragraphs of sp
if p contains "Serial Number:" then
set sn to contents of p
exit repeat
end if
end repeat
sn
end tell
This is a bit quicker & shorter (assumes serial number remains one word):
tell application "System Profiler"
set foo to system profile
last word of (paragraph (count paragraphs in (text 1 thru (offset of "Serial Number" in foo) of foo)) of foo)
end tell
David A
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden