It is currently August 8th, 2020, 11:45 pm

Need a plugin to display my MAC Address

Share and get help with Plugins and Addons
PPowerHouseK
Posts: 5
Joined: December 15th, 2010, 2:07 am

Need a plugin to display my MAC Address

Post by PPowerHouseK »

Hello all,

I am looking for a plugin for Rainmeter to display my current MAC address. I have looked around and have not been able to find something to do that. Perhaps someone can point me in the right direction. Thanks in advance.
User avatar
jsmorley
Developer
Posts: 21218
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need a plugin to display my MAC Address

Post by jsmorley »

PPowerHouseK wrote:Hello all,

I am looking for a plugin for Rainmeter to display my current MAC address. I have looked around and have not been able to find something to do that. Perhaps someone can point me in the right direction. Thanks in advance.
You don't need a plugin. Just use the Registry measure built into Rainmeter and use it to find the info here:

http://www.ehow.com/how_5880140_mac-address-registry.html
PPowerHouseK
Posts: 5
Joined: December 15th, 2010, 2:07 am

Re: Need a plugin to display my MAC Address

Post by PPowerHouseK »

Thank you so much, I think I got it from here.
User avatar
jsmorley
Developer
Posts: 21218
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need a plugin to display my MAC Address

Post by jsmorley »

On looking around, I find that the MAC Address of your NIC is not always stored in the Registry.

Alternatively, you can use this and edit it or steal from it for your skin:
MAC.rmskin
12-15-2010 1-03-11 AM.png
Includes a little addon .exe I just knocked out to get the MAC address and return it to your skin using !RainmeterSetVariable.

Skin source:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]

; Get your nick by pasting "Control Panel\Network and Internet\Network Connections" 
; in the Windows Explorer location bar.  Then right click the desired network 
; connection showing your NIC (Network Interface Card) and copy the name from
; "Properties".  This addon requires the full and correct name of your NIC.
; 
; Set the number in "Formula=Counter % xx" to the number of second between checking.
; Probably best at something really high like 86400 (one day), as your NIC is not going to change.

NICName="Realtek RTL8168B/8111B Family PCI-E Gigabit Ethernet NIC (NDIS 6.20)"
MACAddress="Asking Hardware"

[MeasureFireAction]
Measure=Calc
Formula=Counter % 30
IfEqualValue=0
IfEqualAction=!Execute ["#CURRENTPATH#MAC.exe" "#CURRENTCONFIG#" "#PROGRAMPATH#" "#NICName#"]

[MeterShowNIC]
Meter=String
X=0
Y=2R
FontFace=Sequoe UI
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
Text=NIC Description: #NICName#

[MeterShowMAC]
Meter=String
X=0
Y=2R
FontFace=Sequoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=MAC Address: #MACAddress#
AutoIt Source:

Code: Select all

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Constants.au3>
#include <Array.au3>

Local $Out

if $CmdLine[0] = 3 Then

	$ConfigPath = $CmdLine[1]
	$ProgramPath = $CmdLine[2] & "Rainmeter.exe"
	$NICName = $CmdLine[3]

	$Cmd = Run(@ComSpec & " /c " & 'ipconfig /all', "", @SW_HIDE, $STDOUT_CHILD)

	While 1
		$Out = $Out & StdoutRead($Cmd)
		If @error Then ExitLoop
	Wend

	$NICName=StringReplace($NICName, "\", "\\")
	$NICName=StringReplace($NICName, "(", "\(")
	$NICName=StringReplace($NICName, ")", "\)")
	$NICName=StringReplace($NICName, "[", "\[")
	$NICName=StringReplace($NICName, "]", "\]")

	$RegExp = "(?siU)" & $NICName & ".*Physical Address. . . . . . . . . : (.*)\n"

	$MACAddress = StringRegExp($Out, $RegExp, 3)

	if IsArray($MACAddress) Then
		ShellExecute($ProgramPath, "!RainmeterSetVariable MACAddress " & $MACAddress[0] & " " & $ConfigPath)
	Else
		ShellExecute($ProgramPath, "!RainmeterSetVariable MACAddress Unknown" & " " & $ConfigPath)
	EndIf

EndIf

Exit
You do not have the required permissions to view the files attached to this post.
kenny782
Posts: 6
Joined: June 1st, 2010, 9:44 pm

Re: Need a plugin to display my MAC Address

Post by kenny782 »

I slightly modified it to handle multiple nic's and dynamically pull the names.
Enjoy.

Code: Select all

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Constants.au3>
#include <Array.au3>

Local $Out

if $CmdLine[0] = 4 Then

	$ConfigPath = $CmdLine[1]
	$ProgramPath = $CmdLine[2] & "Rainmeter.exe"
	$NICName = $CmdLine[3]
	$RainVar = $CmdLine[4]

	$Cmd = Run(@ComSpec & " /c " & 'ipconfig /all', "", @SW_HIDE, $STDOUT_CHILD)

	While 1
		$Out = $Out & StdoutRead($Cmd)
		If @error Then ExitLoop
	Wend

	$NICName=StringReplace($NICName, "\", "\\(")
	$NICName=StringReplace($NICName, "(", "\(")
	$NICName=StringReplace($NICName, ")", "\)")
	$NICName=StringReplace($NICName, "[", "\[")
	$NICName=StringReplace($NICName, "]", "\]")

	$RegExp = "(?siU)" & $NICName & ".*Physical Address. . . . . . . . . : (.*)\n"

	$MACAddress = StringRegExp($Out, $RegExp, 3)

	if IsArray($MACAddress) Then
;		ShellExecute($ProgramPath, "!RainmeterSetVariable MACAddress " & $MACAddress[0] & " " & $ConfigPath)
		ShellExecute($ProgramPath, "!RainmeterSetVariable " & $RainVar & " " & $MACAddress[0] & " " & $ConfigPath)
	Else
;		ShellExecute($ProgramPath, "!RainmeterSetVariable MACAddress Unknown" & " " & $ConfigPath)
		ShellExecute($ProgramPath, "!RainmeterSetVariable " & $RainVar & " Unknown" & " " & $ConfigPath)
	EndIf

EndIf

Exit

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

;Metadata added by RainBrowser
;http://rainmeter.net/cms/Rainmeter101-EditingSkins

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata

[Variables]
MACAddress1="Asking Hardware"
MACAddress2="Asking Hardware"

[measureAdapterDesc1]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysinfoType=ADAPTER_DESCRIPTION
SysInfoData=1

[measureAdapterDesc2]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysinfoType=ADAPTER_DESCRIPTION
SysInfoData=0

[MeasureFireAction]
Measure=Calc
Formula=Counter % 30
IfEqualValue=0
IfEqualAction=!Execute ["#CURRENTPATH#MAC.exe" "#CURRENTCONFIG#" "#PROGRAMPATH#" "[measureAdapterDesc1]" "MACAddress1"] !Execute ["#CURRENTPATH#MAC.exe" "#CURRENTCONFIG#" "#PROGRAMPATH#" "[measureAdapterDesc2]" "MACAddress2"]

[MeterShowMAC]
Meter=String
MeasureName=measureAdapterDesc1
X=0
Y=2R
FontFace=Sequoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=%1 #MACAddress1#

[MeterShowMAC2]
Meter=String
MeasureName=measureAdapterDesc2
X=0
Y=2R
FontFace=Sequoe UI
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=%1 #MACAddress2#
User avatar
KreAch3R
Posts: 629
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Need a plugin to display my MAC Address

Post by KreAch3R »

Great work on the little addon. Jsmorley's version works, but kenny's doesn't for some reason. This is what I get:
Image

If anyone can figure out what is happening, please help.
I first installed MAC.rmskin and then replaced mac.ini & mac.au3 contents. Should I have done something else?
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
santa_ryan
Posts: 417
Joined: June 22nd, 2010, 4:11 am

Re: Need a plugin to display my MAC Address

Post by santa_ryan »

Did you compile kenny's with autoit?? Replacing the Au3 doesn't do anything. That's just the source code. You need to compile in AutoIt.
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.
User avatar
KreAch3R
Posts: 629
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Need a plugin to display my MAC Address

Post by KreAch3R »

Thank you and no, I didn't compile anything, as I have no idea how to work with AutoIt scripts. Excuse my complete ignorance. :oops: :) Is it easy to do that or should someone else do this for me? :p
Inactive, due to life changes. Send me a PM for any question.

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

Re: Need a plugin to display my MAC Address

Post by jsmorley »

It's actually pretty easy.

Go here: http://www.autoitscript.com/site/autoit/downloads/

Get the first two items on the list. The "Full Installer" and the "Script Editor". Install them. Make sure to check the "edit script" box when it asks you what to do when opening .au3 files.

Now .au3 files should open in the SciTE editor when you double click on them. In this environment you can edit the code, test it by using "Tools / Go" (errors, and there will be lots of them as you learn, will pop up in a console at the bottom of the screen) and compile to .exe with "Tools / Compile".

When you compile, be sure to select "x86" under "Output arch" and uncheck "Use UPX" (that UPX compression method can give some antivirus apps fits).

The Help menu item in the editor IS YOUR FRIEND. You can just open it and search for what you are trying to do, or highlight any keyword in the code and then click help to zoom right to that function in what I think is one of the better help / manual implementations I have ever used.

P.S. Even if you guys already have AutoIt installed, I would recommend getting the latest version (updated December 23, 2011) as it has some nice fixes and additions. They don't update AutoIt all that often, so when they do, it is worth getting...
User avatar
KreAch3R
Posts: 629
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Need a plugin to display my MAC Address

Post by KreAch3R »

Ok, everything works correctly now. :) I'm impressed by the small amount of time it requires to get your hands dirty. I guess, after .lua, I have to take a look at the AutoIt world. Thanks a lot jsmorley!

Note to first timers: When installing the full installer, make sure to check the "edit script" box when it asks you what to do when opening .au3.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image