It is currently May 4th, 2024, 4:05 am

Showing MAC adress

Get help with creating, editing & fixing problems with skins
Kjodiz
Posts: 2
Joined: September 7th, 2011, 1:15 pm

Showing MAC adress

Post by Kjodiz »

Is it possible to make Rainmeter show your MAC adress?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Showing MAC adress

Post by jsmorley »

I don't now of any way to get it in native Rainmeter, but here is a skin that uses a tiny addon I wrote in AutoIt that works:
MAC.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Showing MAC adress

Post by Seahorse »

Might be possible to use the webparser on a local file, inconjuntion with the command "getmac" and piping the result.

Code: Select all

[Rainmeter]
Update=1000

[Meterforclicking]
Meter=IMAGE
SolidColor=200,200,200,255
W=40
H=40
LeftMouseUpAction=!Execute [getmac>mac.txt ]
Tested from the desk top and the file is created with these contents:

Code: Select all

Physical Address    Transport Name                                            
=================== ==========================================================
00-1A-92-B1-3E-38   \Device\Tcpip_{16BC0201-AEE9-4374-861E-03C64D1053FC}      
00-1A-92-B1-4C-36   Disconnected  
Works fine as a command run on the desktop, however, when run from skin, I can't seem to figure out where the file goes as the pipe doesn't drop the file in the skin directory as I hoped...Windows search doesn't find it either.

Tried this too, as per my paths:

Code: Select all

LeftMouseUpAction=!Execute [cd "E:\Data Files\Rainmeter\Skins\TestSkins"] [getmac>mac.txt ]
Same result.
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Showing MAC adress

Post by jsmorley »

Trouble is, any "pipe to a file and parse" from a skin is going to pop a DOS/Cmd window, which is really ugly. Having said that, your MAC address is never going to change while your PC is running, so you could use that approach and put the action that runs getmac>mac.txt to on OnRefreshAction= in [Rainmeter] and set the UpdateRate on the Webparser measure to -1. This will cause them to only run once when the skin is loaded/refreshed, which may make the Cmd window popup acceptable.

Also, to run a dos command from a skin you need:

!Execute ["cmd.exe" "/c program.exe parameters"]

!Execute ["cmd.exe" "/c getmac > """#CURRENTPATH#outputfile.txt""""]
Wrapped the path in the new Rainmeter "Magic Quotes" (three quotes) to deal with white space in #CURRENTPATH#.

P.S. I kinda prefer my "ipconfig" approach over the "getmac" one, as using ipconfig and specifying the name of the nic means you don't get conflicting results if you have more than one network card, and then you have the name of the card to display as well, which is not returned by getmac.exe.

[Rainmeter]
DynamicWindowSize=1
OnRefreshAction=!Execute ["cmd.exe" "/c ipconfig /all > """#CURRENTPATH#outputfile.txt""""]

[Variables]
NameOfNIC="Realtek RTL8168B/8111B Family PCI-E Gigabit Ethernet NIC"

[MeasureMAC]
Measure=Plugin
Plugin=WebParser
Url=file://#CURRENTPATH#outputfile.txt
RegExp="(?siU).*#NameOfNIC#.*:(.*)\r\n"
UpdateRate=-1
StringIndex=1

[MeterMAC]
Meter=String
MeasureName=MeasureMAC
FontSize=13
FontColor=255,255,255,255
Prefix=#NameOfNIC#:

One thing you need to be careful of are any "reserved characters" in the name of your NIC. "(" and ")" for instance. Those will need to be "escaped" out in your NameOfNIC or they will cause regular expression errors.
Kjodiz
Posts: 2
Joined: September 7th, 2011, 1:15 pm

Re: Showing MAC adress

Post by Kjodiz »

Thank you so much guys :D
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: Showing MAC adress

Post by Seahorse »

jsmorley wrote:P.S. I kinda prefer my "ipconfig" approach over the "getmac" one, as using ipconfig and specifying the name of the nic means you don't get conflicting results if you have more than one network card, and then you have the name of the card to display as well, which is not returned by getmac.exe.
Indeed, but I was happy to have come up with a working method of achieving it that I figured out myself, even if yours is better... :D
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Showing MAC adress

Post by jsmorley »

Seahorse wrote: Indeed, but I was happy to have come up with a working method of achieving it that I figured out myself, even if yours is better... :D
Not sure one is "better" than another at all. I just originally used ipconfig for this kind of stuff (it's a one stop shop for network info) and am used to it.