jumio 发表于 2019-9-27 14:37:33

MAC物理地址显示

本帖最后由 jumio 于 2019-9-27 16:49 编辑

在论坛逛了一圈没有发现提到物理地址显示的帖子,我就来发一篇大家讨论下。

我用autoit 做的脚本来调用mac地址信息,雨滴插件再调用脚本数据显示出来。
这个插件显示MAC地址由于转换问题大概要10秒后才会显示出来。


雨滴皮肤

Update=1000
DynamicWindowSize=1


Name=NETADDRESS
Author=Jumio
Information=Network Information
Version=Sep 9, 2019



;Set this if needed
Interface=Best

MACAddress="Asking Hardware"

Font=Trebuchet MS
LabelColor=200,200,200
ValueColor=200,200,200

;=================================


Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=IP_ADDRESS
SysInfoData=0


Meter=String
X=0r
Y=0r
FontFace=#Font#
FontColor=#LabelColor#
FontSize=9
StringStyle=Normal
StringAlign=Left
AntiAlias=1
Text="IP地址:"


Meter=String
MeasureName=MeasureIPLan
X=160r
Y=2r
FontFace=#Font#
FontColor=#ValueColor#
FontSize=9
StringStyle=Normal
StringAlign=Right
AntiAlias=1


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


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


Meter=String
X=0
Y=20r
FontFace=#Font#
FontSize=9
FontColor=#ValueColor#
StringStyle=Normal
AntiAlias=1
DynamicVariables=1
Text=MAC地址: #MACAddress# autoit 脚本内容

; *** Start added by AutoIt3Wrapper ***
#include <AutoItConstants.au3>
; *** End added by AutoIt3Wrapper ***
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_Change2CUI=n
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

Local $Out

if $CmdLine = 3 Then

      $ConfigPath = $CmdLine
      $ProgramPath = $CmdLine & "Rainmeter.exe"
      $NICName = $CmdLine

      $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 & ".*物理地址. . . . . . . . . . . . . : (.*)\n"

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

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

EndIf

Exit


页: [1]
查看完整版本: MAC物理地址显示