• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: About This Mac
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About This Mac


  • Subject: Re: About This Mac
  • From: Aurelio Marinho Jargas <email@hidden>
  • Date: Mon, 7 Nov 2005 15:42:15 -0200

hi rhon,

looking at all this delimiters party, i want to propose another approach, more UNIXer, that maybe simplifies this problem:

$ system_profiler -detailLevel -2 | egrep '(System Version|CPU Speed|CPU Type|Memory): ' | cut -d: -f2-
PowerPC G4 (1.1)
1.07 GHz
768 MB
Mac OS X 10.3.9 (7W98)
$


this long command gives you the data you want in four lines. so you can save the results to a list, each line a list item. then you have direct access to the information.

full example:

-- get system info
set theInfo to do shell script "system_profiler -detailLevel -2 | egrep '(System Version|CPU Speed|CPU Type|Memory): ' | cut -d: -f2-"
-- lines turns to list items
set AppleScript's text item delimiters to return
set theList to text items of theInfo
set AppleScript's text item delimiters to ""
-- get results
item 1 of theList -- system version
item 2 of theList -- cpu speed
item 3 of theList -- cpu type
item 4 of theList -- memory
3rd word of item 1 of theList -- build version



bye!


Em 20/10/2005, às 12:41, Rhon Fitzwater escreveu:

Bill et all,

Thank you very much for your help. I was aware of the system_profiler command, and I have used it in the past. My intentions of the posting to the list was to try and see how others are getting this information, or if there was a good way to get the information from the About This Mac window already formated...

I ended up using the code below to get the information I needed.

set p to do shell script "/usr/sbin/system_profiler -detailLevel mini" --using detailLevel mini will speed the command up a little
set AppleScript's text item delimiters to "System Version: "
set sysVer to paragraph 1 of (text item 2 of p)
set AppleScript's text item delimiters to "CPU Speed: "
set cpuSpeed to paragraph 1 of (text item 2 of p)
set AppleScript's text item delimiters to "CPU Type: "
set cpuType to paragraph 1 of (text item 2 of p)
set AppleScript's text item delimiters to "Memory: "
set memAmount to paragraph 1 of (text item 2 of p)
set AppleScript's text item delimiters to "("
set OSversion to (text item 1 of sysVer)
set buildVersion to (text item 2 of sysVer)
set AppleScript's text item delimiters to ")"
set buildVersion to (text item 1 of buildVersion)
set AppleScript's text item delimiters to " "


set contents of text field "version" of box "system" of statusPanel to (text item 4 of OSversion)
set contents of text field "build" of box "system" of statusPanel to buildVersion
set contents of text field "processor" of box "system" of statusPanel to cpuSpeed & " " & cpuType
set contents of text field "memory" of box "system" of statusPanel to memAmount


Hopefully this code will be useful to others.

Thanks to everyone who replied.

-Rhon

On Oct 20, 2005, at 10:02 AM, Bill White wrote:

On 10/19/05 9:52 PM, Rhon Fitzwater <email@hidden> wrote:


I would like to have a window in my application include the same
information that the About this Mac windows shows.
I.E:
System Version: 10.4.2
Build Number: 8C46
Processor: 1.5 GHz PowerPC G4
Memory: 1.25 GB DDR SDRAM

How can I get the information?

Thanks in advance,

-Rhon


Rhon,

I notice nobody seems to want to give you a concrete answer. Something like
the following should get you basically what you're after, although you'll
have to fiddle a bit to get the format exactly as you want it:


set p to do shell script "system_profiler"

set AppleScript's text item delimiters to "System Version: "

set sysVer to paragraph 1 of (text item 2 of p)

set AppleScript's text item delimiters to "CPU Speed: "

set cpuSpeed to paragraph 1 of (text item 2 of p)

set AppleScript's text item delimiters to "CPU Type: "

set cpuType to paragraph 1 of (text item 2 of p)

set AppleScript's text item delimiters to "Memory: "

set memAmount to paragraph 1 of (text item 2 of p)

set AppleScript's text item delimiters to ""

return "System Version: " & sysVer & return & "Processor: " & cpuSpeed & " "
& cpuType & return & "Memory: " & memAmount -- watch line wraps here


Hope that helps,

Bill




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden

-- Aurélio Marinho Jargas - Curitiba http://aurelio.net






_______________________________________________________ Yahoo! Acesso Grátis: Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/

_______________________________________________
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


  • Prev by Date: RE: Who has that property?
  • Next by Date: Launching a shell script nested inside a bundle
  • Previous by thread: Alias listfrom find shell
  • Next by thread: Launching a shell script nested inside a bundle
  • Index(es):
    • Date
    • Thread