• 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: getting user's system info
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting user's system info


  • Subject: Re: getting user's system info
  • From: Chris Espinosa <email@hidden>
  • Date: Fri, 21 Jan 2005 16:43:31 -0800

On Jan 21, 2005, at 3:36 PM, Graham Anderson wrote:

is there an applescript / shell script for getting user environment variables like: ram, cpu, os, and etc

There is a scripting addition for user environment variables (in the classic UNIX sense):
get system attribute
{"SECURITYSESSIONID", "HOME", "SHELL", "USER", "PATH", "__CF_USER_TEXT_ENCODING"}

That lists all environment variables available in the user process space. Use the text form of the environment variable to get its value:
get system attribute "HOME"
-- "/Users/loginname"

Now those don't encompass RAM, CPU, OS, etc. because those aren't environment variables. But there are other system attribute properties for some of those, but you must use the four-character "Gestalt" selector. A good description of how to do this is on this page:

http://www.foodoo.sunreal.com.au/info/gestalt.html

Some examples:
get system attribute "ram " -- note the space
-- 402653184

But the Gestalt mechanism doesn't cover some more modern machines or configuration values, you may have to resort to the do shell script mechanism and execute the sysctl command:
do shell script "sysctl hw.cputype; sysctl hw.cpusubtype"
-- "hw.cputype: 18
hw.cpusubtype: 11"

and you'll have to look up in the Mac OS X programmer header files what the values refer to. These can be quite cryptic, but start with

http://darwinsource.opendarwin.org/10.3/xnu-517/bsd/sys/sysctl.h
http://darwinsource.opendarwin.org/DevToolsDec2001/cctools-384.1/include/mach/machine.h

>From these you could discern that the processor on this machine is a PowerPC 7450, i.e. a G3.

Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >getting user's system info (From: Graham Anderson <email@hidden>)

  • Prev by Date: Re: getting user's system info
  • Next by Date: Re: iWork Pages
  • Previous by thread: Re: getting user's system info
  • Next by thread: calling subroutine as a conditional
  • Index(es):
    • Date
    • Thread