Search the Community
Showing results for tags 'mac'.
-
Hello! I have a question , about Mac and Autoit3. I want to convert my script to Mac App,but Aut2Exe just convert to EXE! So I asked if there was a way to convert scripts to MAC App My English isn't very good,so don't laugh please😃
-
Version 1.0
755 downloads
Did this because i needed, retrieves a list of adapters from the registry, shows you your current Mac Address of the adapter in use, the user simply changes the second input field to the address he wants, then select the adapter on the list, and click 'set', after a reboot, the mac should be changed. (The field to input the mac to set accepts '-' ':' or no separation character. ex: AA:BB:CC... or AA-BB-CC... or AABBCC...)- 1 comment
- 1 review
-
- Mac Address
- Address
-
(and 1 more)
Tagged with:
-
The code works on windows 7 but not on XP... why so? #include <File.au3> Global $sIP, $MAs $Station=InputBox("Workstation", "enter the workstation", "") _GetMACFromIP($sIP) Local $text = StringReplace($MAs, "-", "") IniWrite(@ScriptDir & "\MAC.ini", "mac_addresses", $Station, $text) Func _GetMACFromIP($sIP) Local $MAC,$MACSize Local $MAi,$MAr ;Create the struct $MAC = DllStructCreate("byte[6]") ;Create a pointer to an int $MACSize = DllStructCreate("int") ;*MACSize = 6; DllStructSetData($MACSize,1,6) ;call inet_addr($sIP) $MAr = DllCall ("Ws2_32.dll", "int", "inet_addr", _ "str", $sIP) $iIP = $MAr[0] ;Make the DllCall $MAr = DllCall ("iphlpapi.dll", "int", "SendARP", _ "int", $iIP, _ "int", 0, _ "ptr", DllStructGetPtr($MAC), _ "ptr", DllStructGetPtr($MACSize)) ;Format the MAC address into user readble format: 00:00:00:00:00:00 $MAs = "" For $MAi = 0 To 5 If $MAi Then $MAs = $MAs & "-" $MAs = $MAs & Hex(DllStructGetData($MAC,1,$MAi+1),2) Next ;Return the user readble MAC address Return $MAs EndFunc Resolved by using this code instead: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=MAG.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> #include <File.au3> $IPDetails=_IPDetails() $Station=InputBox("Workstation", "enter the workstation", "") Local $text = StringReplace($IPDetails[1], ":", "") IniWrite(@ScriptDir & "\MAC.ini", "mac_addresses", $Station, $text) Func _IPDetails() Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True", "WQL", 0x30), $aReturn[5] = [4] If IsObj($oColItems) Then For $oObjectItem In $oColItems If $oObjectItem.IPAddress(0) == @IPAddress1 Then $aReturn[1] = $oObjectItem.MACAddress $aReturn[2] = $oObjectItem.DefaultIPGateway(0) EndIf Next Return $aReturn EndIf Return SetError(1, 0, $aReturn) EndFunc ;==>_IPDetails