• 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: Display Model Name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display Model Name


  • Subject: Re: Display Model Name
  • From: Christopher Stone <email@hidden>
  • Date: Wed, 14 Sep 2011 18:20:06 -0500

On Sep 14, 2011, at 15:35, Jeffrey Madson wrote:
Here is my script and error message below. Any suggestions would be greatly appreciated.
______________________________________________________________________

Hey Jeffrey,

If you simply run 'system info' in the Applescript Editor you can see that there is not an available ModelName item in Lion or apparently Snow Leopard.

I think Stan probably has the quickest solution, and here's an easy way to parse out the model name:

# Keeping the hardware data record:
set hardwareData to do shell script "system_profiler SPHardwareDataType" without altering line endings
set cmd to "sed -nE '/Model Name/p' <<< " & quoted form of hardwareData & " | sed -E 's/^ +//'"
set macModel to do shell script cmd

# One-liner:
set macModel to do shell script "system_profiler SPHardwareDataType | sed -nE '/Model Name/p'| sed -E 's/^ +//'"

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Display Model Name (From: Jeffrey Madson <email@hidden>)

  • Prev by Date: Changes to Address Book?
  • Next by Date: Re: entire contents
  • Previous by thread: Re: Display Model Name
  • Next by thread: Display Model Name
  • Index(es):
    • Date
    • Thread