Hi, is it possible to get the type of Mac eg. MacBook or iMac ?
Any help would be much appreciated!
Model: MacBook Pro 2.53 GHz
AppleScript: 2.1.2
Browser: Firefox 4.0b6
Operating System: Mac OS X (10.6)
Hi, is it possible to get the type of Mac eg. MacBook or iMac ?
Any help would be much appreciated!
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: http://macscripter.net/viewtopic.php?id=25531
set prefFolderPath to path to preferences folder as text
set prefFileName to "com.name.app.plist"
set prefFilePath to prefFolderPath & prefFileName
repeat
try
get prefFilePath as alias
set plistExist to "true"
on error
tell application "System Profiler"
activate
set mac to name of window 1
set mac to quoted form of mac as text
quit
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 com.name.app MacType " & mac
else
--if plist does exist, verify key to read exists
if plistExist is "true" then
try
set mac do shell script "defaults read com.name.app MacType"
on error
--if domain key pair does not exist, create with default value
do shell script "defaults write com.name.app 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 com.name.app MacType"
Hi,
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?