• 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: Stan Cleveland <email@hidden>
  • Date: Mon, 19 Sep 2011 15:06:51 -0700

On Sep 15, 2011, at 7:55 AM, Jeffrey Madson wrote:

> That script gives me even more ideas of some items to include in the main display window. How do you parse information out of the script results with Apple Script?

Hi Jeffrey,

Sorry for my slow reply, but was away for several days for a wedding.

Parsing is any method of extracting smaller bits of data from a larger chunk. For example, the following code will break up the hardware report into more useful bits:
	set hardwareData to do shell script "system_profiler SPHardwareDataType"
	set oldTIDs to AppleScript's text item delimiters
	set AppleScript's text item delimiters to (return & "      ")
	set bits to text items 2 thru -3 of hardwareData
	set AppleScript's text item delimiters to oldTIDs
	return bits
From there, you'd need to split each returned string at the colon.

If you utilize the XML-formatted hardware data, you can parse it with the XML suite built into System Events or either of these free scripting additions:
	XML Tools.osax from Late Night Software
	XMLLib.osax from Satimage Software

Stan C.

 _______________________________________________
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: Re: DiskImageMounter
  • Next by Date: Re: Display Model Name
  • Previous by thread: Re: Display Model Name
  • Next by thread: Changes to Address Book?
  • Index(es):
    • Date
    • Thread