Machine() function not showing Mac?

Ken Ray kray at sonsothunder.com
Sat Feb 26 01:45:09 EST 2005


On 2/22/05 12:50 PM, "Frank D. Engel, Jr." <fde101 at fjrhome.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Using "uname -m" yields "Power Macintosh", btw...

Here's a framework that I've started to get the computer name - I only have
OS X implemented, but I'll fill it in with Win32  (and hopefully OS 9) soon:

on mouseUp
  answer stsComputerType()
end mouseUp

function stsComputerType
  local tType
  switch (the platform)
  case "MacOS"
    if isOSX() then
      put shell("system_profiler SPHardwareDataType") into tData
      get matchText(tData,"(?s)Machine Model:\W*(.*?)\n",tType)
      if it is true then
        return tType
      else
        return "Error: Can't locate computer type."
      end if
    else
      -- No OS 9 version yet
    end if
    break
  case "Win32"
    -- No Win32 version yet
    break
  end switch
end stsComputerType

function isOSX
  set the itemDel to "."
  return (item 1 of the systemVersion >=10)
end isOSX

---

On my Mac, this returns 'PowerMac G4'.

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com





More information about the use-livecode mailing list