Re: Hardware Mac Address
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.