Get type of Mac

Hi, is it possible to get the type of Mac eg. MacBook or iMac ?

Any help would be much appreciated! :slight_smile:

Model: MacBook Pro 2.53 GHz
AppleScript: 2.1.2
Browser: Firefox 4.0b6
Operating System: Mac OS X (10.6)

Done it myself and written it to a plist. This thread helped:

set prefFolderPath to path to preferences folder as text
set prefFileName to ""
set prefFilePath to prefFolderPath & prefFileName

        get prefFilePath as alias
        set plistExist to "true"
    on error
        tell application "System Profiler"
            set mac to name of window 1
            set mac to quoted form of mac as text
        end tell
        set plistExist to "false"
    end try
    --if plist does not exist create it
    if plistExist is "false" then
        --create domain key pair with default value
        do shell script "defaults write MacType " & mac
        --if plist does exist, verify key to read exists
        if plistExist is "true" then
                set mac do shell script "defaults read MacType"
            on error
                --if domain key pair does not exist, create with default value
                do shell script "defaults write MacType " & mac
            end try
            exit repeat
        end if
    end if
end repeat

Then I just read it back with

set mac do shell script "defaults read MacType"


Instead of the model you get the (host) name of the computer.
This information can be retrieved much easier

set mac to computer name of (system info)

Personally I would parse it from which ever of the system profiler data types.

set Foo to do shell script "system_profiler SPHardwareDataType"

Thanks guys!! I have a menu item, how do I make it so that if my variable “mac” is “Desktop Mac” the menu item will be like disabled or hidden?