• 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: Hardware Mac Address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hardware Mac Address


  • Subject: Re: Hardware Mac Address
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 12 Jun 2004 08:25:45 -0700

On 6/12/04 6:24 AM, "Robert Poland" <email@hidden> wrote:

>> Hi,
>> does anyone know a way to get the hardware Mac Address of my computer
>> someway?
>>
>> Ronald

>
> This works for me (OS 10.3.4);
>
> tell application "Finder"
> set sysID to "" & ((words 2 thru -1 of (do shell script
> "ifconfig en0 | grep 'ether'")) as string)
> end tell
> display dialog sysID


There's absolutely no need for the Finder - what's that doing there? You
also don't need both ("" & ) and also 'as string': they do the same thing.

However you DO need to set text item delimiters. The default is {""} so with
your script most people will end up losing the ":" from the result, since
AppleScript also sees ":" as a word separator:

-->"000a958f49d8"

If that's actually what you want you should set delimiters to {""} -
otherwise you might end up with something like this (if delimiters just
happened to have been left at "orange", say form the last time you used
script editor:


Here's one way:

set AppleScript's text item delimiters to {":"}
set sysID to words 2 thru -1 of (do shell script "ifconfig en0 | grep
'ether'") as string
set AppleScript's text item delimiters to {""}
sysID
--> "00:0a:95:8f:49:d8"


Here's another:

set AppleScript's text item delimiters to {" "}
set sysID to text item 2 of (do shell script "ifconfig en0 | grep
'ether'")
set AppleScript's text item delimiters to {""}
sysID
--> 00:0a:95:8f:49:d8
--
Paul Berkowitz

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Hardware Mac Address (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: eppc -> "Remote Access Not Allowed"?
  • Next by Date: Re: Hardware Mac Address
  • Previous by thread: Re: Hardware Mac Address
  • Next by thread: Re: Hardware Mac Address
  • Index(es):
    • Date
    • Thread