• 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: One for the experts: Serial Number of computer using Applescript Studio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One for the experts: Serial Number of computer using Applescript Studio


  • Subject: Re: One for the experts: Serial Number of computer using Applescript Studio
  • From: Gabe Lucero <email@hidden>
  • Date: Fri, 17 Jun 2005 12:03:06 -0700

Title: Re: One for the experts: Serial Number of computer using Applescript Studio
All of the sn retrieval suggestions worked in Tiger 10.4.1 just fine. However, how could I pull the serial number without the result being-

“
Serial Number: QP510016PNZ"

But rather just the sn so I can paste it into the Remote Desktop computer info fields? Such as-

“
QP510016PNZ”

I used the following script to do this in 10.3 but it won’t work in 10.4 for some reason.

set Profile to do shell script "/usr/sbin/system_profiler SPHardwareDataType"
set SN_Start to ((offset of "Serial Number" in Profile) + 15)
set Partial to text SN_Start thru (length of Profile) of Profile
set SN_End to offset of " " in Partial
set SN to text 1 thru SN_End of Partial


These are the two scripts I’ve found will work in 10.4 but gives me the whole sn line:

do shell script "system_profiler SPHardwareDataType | grep Serial"


And


tell application "System Profiler"
    set SN to ""
    set sp to system profile
   repeat with p in paragraphs of sp
       if p contains "Serial Number:" then
           set SN to contents of p
           exit repeat
       end if
   end repeat
   SN
end tell
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: One for the experts: Serial Number of computer using Applescript Studio
      • From: Martin Orpen <email@hidden>
    • Re: One for the experts: Serial Number of computer using Applescript Studio
      • From: Hudson Barton <email@hidden>
    • CURL vs FTP
      • From: Bruce Robertson <email@hidden>
  • Prev by Date: Re: "info for" always failing in Automator action script
  • Next by Date: CURL vs FTP
  • Previous by thread: Re: "info for" always failing in Automator action script
  • Next by thread: CURL vs FTP
  • Index(es):
    • Date
    • Thread