TheSovereign Posted July 3, 2009 Share Posted July 3, 2009 (edited) I found this thread and the starting script. The script worked not (but not of the main WOL feature, but because it uses only @IpAdress1) By writing something around the script finally I came to a little bigger script..... What could the extended script do? 1) You can enter a IP START and and IP STOP address. The script enumerate the last ip segment (sorry but enumerate in all possible addresses does not fit to my need....) The script will then write a file(MACLIST.DAT) in the format: [MACLISTE] 192.168.0.1=08000e42faa7 192.168.0.2=0090fb181c18 2) Of course you can edit the file manually and read via button MACLIST.DAT 3) The file will be read on startup and will display the content in a listview 4) Now you can select a single entry and push the button WAKE UP SELECTED or 5) Send magic packet to all in the listview 6) it will send the magic packet via @IPAddress1 to @IPAddress4, in my PC there are 4 adapters and the mac was on @IPAddress3..... 7) The button SET TIMER to now will set the time controls(combo) (three) to the current time 8) If you activate the timer with the button ACTIVATE TIMER the script will wait until the EXACT (yes, yes, that's not so nice and a possible gap) and will wake up all in the list 9) The status is just for displaying what is going on So, as parts of this script are from the community, I want to give something back. I tested this stuff on XP32/SP3 German. Maybe you can tell if this works for you as well. This is my first contribution to the forum, so please do not punish me for writing wrong coding rules... In case of errors please correct my script (but at least here it worked fine :-) ) ... Tankbuster, that is an awesome script, thank you for sharing!! =) I just had to make a modification to the get_mac() function because the script would crash if it attempted to process the IP/MAC of the PC it was running on: in that case, I observed that the $aOutputLine array did not contain enough elements. So here is the modified get_mac() function that worked for me... func get_mac($remote_ip,$filemaclist="MACLIST.DAT") Ping($remote_ip,200) if @error =0 Then $arpinfo = Run(@ComSpec & " /c ARP -a "&$remote_ip, @SystemDir, @SW_HIDE, 2) sleep(200) $output = StdoutRead($arpinfo, -1) $aOutputLine=StringSplit($output,@CRLF) If UBound($aOutputLine) > 5 Then ; <=== added so script doesn't choke when processing the IP for the computer it's running on $macadress=Stringmid($aOutputLine[7],25,17) $macadress=StringReplace($macadress,"-","") IniWrite(@ScriptDir&"\"&$filemaclist,"MACLISTE",$remote_ip,$macadress) setStatusMsg("Found maclist "&$macadress) EndIf ; <=== and this one... Else setStatusMsg("Host "&$remote_ip&" not reachable") Return endif EndFunc Edited July 3, 2009 by TheSovereign [font="Courier New"]__________________________________________________There is always another way, usually a better one.[/font] Link to comment Share on other sites More sharing options...
Tankbuster Posted July 20, 2009 Share Posted July 20, 2009 (edited) Tankbuster, that is an awesome script, thank you for sharing!! =)Thx So here is the modified get_mac() function that worked for me.......I added this to my post, as it makes the script better ...@gcue1. i shut down pc2. wake it up - and it works!3. shut down pc again << -- I think this overwrites in some ways the S3 state, in otherwords the networkcard does not care about the magic packets4. wake it up - fails5. turn on pc manually 6. wake it up - and it works!..I did the same thing with XP pcs. As long as I use the "shutdown" command of xp WOL was working, but if I pressed the Powerbutton (and the OS was shutting down the os), WOL was not able to start the PC. I guess I need to change the network card energy settings, but this is just a suggestion. Edited July 20, 2009 by Tankbuster Link to comment Share on other sites More sharing options...
CrazyThom Posted September 1, 2009 Share Posted September 1, 2009 (edited) Thx to all for this code. works fine, i made a script to switch on my PCs in my LAN with a small GUI and i used an external exe before to make the WOL call, but now i implemented it into the script. And now i am working on a script that shut downs the PCs remotely, but i have some trouble with the remote access to the other PCs... Edited September 1, 2009 by CrazyThom Link to comment Share on other sites More sharing options...
Tankbuster Posted September 14, 2009 Share Posted September 14, 2009 And now i am working on a script that shut downs the PCs remotely, but i have some trouble with the remote access to the other PCs... I'm just guessing, but you got user right problems , correct? You need a user that is able to shutdown (eg. Administrator). On comandline you need to connect as a user to IPC$ and than execute the shutdown command. C:\>net use \\yourpc SuperPass /u:yourpc\Superadmin C:\>shutdown -i -s -m \\yourpc -t 10 -c "AdminsLastWill" I'm not aware of one, but I think Autoit (or UDF) will already offer such ways "inside" Autoit. But I think it's about user rights. I will have a look too, as the feature would be nice to have .... If I find something I will post it here again... Link to comment Share on other sites More sharing options...
Alomax Posted November 16, 2009 Share Posted November 16, 2009 Tankbuster, thanks for this script, it's been very useful! The MAC scanner is a great time-saver. I've used this to replace the broken WOL feature in the Smartlaunch control software that I have to deal with at client locations. /beer Link to comment Share on other sites More sharing options...
RichE Posted March 30, 2010 Share Posted March 30, 2010 (edited) there is an easier way to get the mac address instead of using the arp command, you can use the "getmac" command via dos, it has a less convoluted output. Edited March 30, 2010 by l15ard RichE [font="'Arial Narrow';"]Current projects[/font] [font="'Arial Narrow';"]are on my site [/font]Sellostring Link to comment Share on other sites More sharing options...
Tankbuster Posted March 31, 2010 Share Posted March 31, 2010 (edited) Correct getmac is nicer to look at and gives better formatted results (CSV,FILE,TABLE) but you need a user and a password. GETMAC [/S system [/U username [/P [password]]]] [/FO format] [/NH] [/V] Also I think it will work only with Windows Clients, but I will remember it in case of a certain use case. Thank you for the hint. Edited March 31, 2010 by Tankbuster Link to comment Share on other sites More sharing options...
Tankbuster Posted March 31, 2010 Share Posted March 31, 2010 (edited) As time goes by, I returned to this script, as I found out that my old script now does not work anymore....Why? As I installed VMWare player (some time ago) I got now 6 Networkadapters some virtual ones and some real ones.So the @IpAdress thing does not work anymore (1 to 4).I added a function by 99ojo WMI NETWORKADAPTER LLIST And during the implementation of this function I found some other stuff that would be nice to have (like the mentioned Commandline).If you got a MACLIST you could start the WOLLE (it's for Wake-On-Lan-Light-Edition or translated from German to English : Wool )WOLLE /?WOLLE HH:MM:SS RESTART|EXITThe first argument is the time of course and the second one is what should the WOLLE do after triggering, just Exit or Restart (and wait for the same time again on the next day)If you got some other ideas (like the getmac command see previous post), would be nice if you extend my version (and post it of course)If you find errors, do not punish me, help me to solve it.So here is the script (attached is the .AU3 file with a screen shot):Tested and compiled here with 3.3.4.0expandcollapse popup#include <Array.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #Include <Date.au3> AutoItSetOption ( "GUICoordMode",1) Global $aNetWorkAdapters [1] [2] ; Global array for network adapter and ip global $NextHH,$NextMM,$NextSS,$NextRun _getnetworkadapter () $filemaclist="MACLIST.DAT" Dim $MACAddressList[1] ; =================================================================== ; Gui ; ; =================================================================== $mainwindow=GUICreate("WOLLE",500,600) $mwbtnExit=GUICtrlCreateButton("Exit",350,150,100) $mwbtnGetMac=GUICtrlCreateButton("Get Mac adresses",10,150,100) $mwbtnWakeupall=GUICtrlCreateButton("Wake up all in list",130,150,100) $mwbtnWakeupSelected=GUICtrlCreateButton("Wake up selected",240,150,100) $mwlblIpRange=GUICtrlCreateLabel("Enter Start and End IP for search, will only search for last segment, sorry....",10,115,200,30) $mvinpIpStart=GUICtrlCreateInput("192.168.0.1",250,120,100,15) $mvinpIpStop=GUICtrlCreateInput("192.168.0.10",350,120,100,15) $mvinpWakeupTimeHH=GUICtrlCreateCombo("00",10,220,40) $mvinpWakeupTimeMM=GUICtrlCreateCombo("00",50,220,40) $mvinpWakeupTimeSS=GUICtrlCreateCombo("00",90,220,40) FillTimeCombos() $mwbtnActivateTimer=GUICtrlCreateButton("Activate Timer",290,220,120) $mwbtnSetTimertoNow=GUICtrlCreateButton("Set Timer to now",160,220,120) $mwbtnReadMacListFile=GUICtrlCreateButton("read MACLIST.DAT",260,20,120) $mwbtnMarkAllMacList=GUICtrlCreateButton("Mark All",260,50,80) $mwbtnUNMarkAllMacList=GUICtrlCreateButton("Un-Mark All",260,80,80) $mwlvMacadresses=GUICtrlCreateListView("MacAdresses |IP ",10,10,250,100,-1,bitor($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES)) $mwlblStatus=GUICtrlCreateLabel("Status:",10,180,400) GUICtrlSetColor(-1,0xff0000) $mwlblStatusNext=GUICtrlCreateLabel("Next:",10,200,400) GUICtrlSetColor(-1,0x0099aa) $mwlblWOLDelay1=GUICtrlCreateLabel("WOL DelayTimer (between two WOL msg)",10,500,100,15) $mwinpWOLDelay=GUICtrlCreateInput("1000",110,500,100,15) $mwlblWOLDelay2=GUICtrlCreateLabel("ms (Keep an eye on the power usage on startup of a PC)",150,500,400,15) $mwlvNetWorkAdapters=GUICtrlCreateListView("Name |IP ",10,270,405,200,-1,bitor($LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES)) $mwbtnMarkAllAdapters=GUICtrlCreateButton("Mark All",415,220,80) $mwbtnUNMarkAllAdapters=GUICtrlCreateButton("Un-Mark All",415,250,80) readmacfile() setTimertoNow() addNetworkAdapters2ListView() global $RunType="GUI" if $CmdLine[0]=2 then GUISetState(@SW_SHOW) $RunType="COMMANDLINE" $CommandlineWakeUpTime=$CmdLine[1] $CommandlineCompleteCommand=$CmdLine[2] local $aCommandLineTime=StringSplit($CommandlineWakeUpTime,":") guictrlsetdata($mvinpWakeupTimeHH,$aCommandLineTime[1]) guictrlsetdata($mvinpWakeupTimeMM,$aCommandLineTime[2]) guictrlsetdata($mvinpWakeupTimeSS,$aCommandLineTime[3]) $boolTimerActive=1 DisableControls(1) elseif $CmdLine[0]=1 then msgbox(0,"WOLLE","Commandline Parameter"&@CRLF&"PARA1 = Wakeuptime"&@CRLF&"PARA2 = COMMAND after WAKUP (EXIT - RESTART)"&@CRLF&"WOLLE HH:MM:SS EXIT") exit Else GUISetState(@SW_SHOW) $boolTimerActive=0 EndIf While 1 $msg = GUIGetMsg() select case $msg = $GUI_EVENT_CLOSE ExitLoop case $msg = $mwbtnExit ExitLoop case $msg = $mwbtnWakeupall wol_all() case $msg = $mwbtnGetMac getmacinrange() case $msg = $mwbtnGetMac getmacinrange() case $msg = $mwbtnWakeupSelected wol_selected() case $msg = $mwbtnReadMacListFile readmacfile() case $msg = $mwbtnMarkAllMacList togglelistviewcheckboxes($mwlvMacadresses,true) case $msg = $mwbtnUNMarkAllMacList togglelistviewcheckboxes($mwlvMacadresses,false) case $msg = $mwbtnMarkAllAdapters togglelistviewcheckboxes($mwlvNetWorkAdapters,true) case $msg = $mwbtnUNMarkAllAdapters togglelistviewcheckboxes($mwlvNetWorkAdapters,false) case $msg = $mwbtnActivateTimer if $boolTimerActive=1 Then DisableControls(0) Else DisableControls(1) endif case $msg = $mwbtnSetTimertoNow setTimertoNow() EndSelect if $boolTimerActive=1 Then CheckWakeup() sleep(100) endif WEnd GUIDelete() exit ; =================================================================== ; Function: setTimertoNow ; sets the thre time controls to the current time ; =================================================================== func setTimertoNow() guictrlsetdata($mvinpWakeupTimeHH,@HOUR) guictrlsetdata($mvinpWakeupTimeMM,@MIN) guictrlsetdata($mvinpWakeupTimeSS,@SEC) EndFunc ; =================================================================== ; Function: DisableControls($TimerState) ;~ $TimerState = 0 = Enable ;~ $TimerState = 1 = Disable ; Toggle for the Timer button ; =================================================================== func DisableControls($TimerState) $boolTimerActive=$TimerState if $TimerState = "0" Then GUICtrlSetState($mwbtnExit,$GUI_ENABLE) GUICtrlSetState($mwbtnGetMac,$GUI_ENABLE) GUICtrlSetState($mwbtnWakeupall,$GUI_ENABLE) GUICtrlSetState($mwbtnWakeupSelected,$GUI_ENABLE) GUICtrlSetState($mvinpIpStart,$GUI_ENABLE) GUICtrlSetState($mvinpIpStop,$GUI_ENABLE) GUICtrlSetState($mvinpWakeupTimeHH,$GUI_ENABLE) GUICtrlSetState($mvinpWakeupTimeMM,$GUI_ENABLE) GUICtrlSetState($mvinpWakeupTimeSS,$GUI_ENABLE) GUICtrlSetState($mwbtnReadMacListFile,$GUI_ENABLE) GUICtrlSetState($mwbtnSetTimertoNow,$GUI_ENABLE) GUICtrlSetState($mwlvMacadresses,$GUI_ENABLE) GUICtrlSetState($mwlvNetWorkAdapters,$GUI_ENABLE) GUICtrlSetState($mwbtnMarkAllMacList,$GUI_ENABLE) GUICtrlSetState($mwbtnUNMarkAllMacList,$GUI_ENABLE) GUICtrlSetState($mwbtnMarkAllAdapters,$GUI_ENABLE) GUICtrlSetState($mwbtnUNMarkAllAdapters,$GUI_ENABLE) GUICtrlSetData($mwbtnActivateTimer," Activate Timer") setStatusMsg("Timer deactivated") setStatusMsgNext("") Else GUICtrlSetState($mwbtnExit,$GUI_DISABLE) GUICtrlSetState($mwbtnGetMac,$GUI_DISABLE) GUICtrlSetState($mwbtnWakeupall,$GUI_DISABLE) GUICtrlSetState($mwbtnWakeupSelected,$GUI_DISABLE) GUICtrlSetState($mvinpIpStart,$GUI_DISABLE) GUICtrlSetState($mvinpIpStop,$GUI_DISABLE) GUICtrlSetState($mvinpWakeupTimeHH,$GUI_DISABLE) GUICtrlSetState($mvinpWakeupTimeMM,$GUI_DISABLE) GUICtrlSetState($mvinpWakeupTimeSS,$GUI_DISABLE) GUICtrlSetState($mwbtnReadMacListFile,$GUI_DISABLE) GUICtrlSetState($mwbtnSetTimertoNow,$GUI_DISABLE) GUICtrlSetState($mwlvMacadresses,$GUI_DISABLE) GUICtrlSetState($mwlvNetWorkAdapters,$GUI_DISABLE) GUICtrlSetState($mwbtnMarkAllMacList,$GUI_DISABLE) GUICtrlSetState($mwbtnUNMarkAllMacList,$GUI_DISABLE) GUICtrlSetState($mwbtnMarkAllAdapters,$GUI_DISABLE) GUICtrlSetState($mwbtnUNMarkAllAdapters,$GUI_DISABLE) GUICtrlSetData($mwbtnActivateTimer," De-Activate Timer") EndIf EndFunc ; =================================================================== ; Function: CheckWakeup ; critical only equal time will trigger (needs something better like a small range) ; =================================================================== func CheckWakeup() local $intWakeupTime=(GUICtrlRead($mvinpWakeupTimeHH)*60*60)+(GUICtrlRead($mvinpWakeupTimeMM)*60)+GUICtrlRead($mvinpWakeupTimess) local $intNow=(@HOUR*60*60)+(@MIN*60)+@SEC setStatusMsg("Current time:"&@HOUR&":"&@MIN&":"&@SEC) $NextRun=$intWakeupTime-$intNow if $NextRun<0 then $NextRun=($NextRun+(24*60*60))*1000 EndIf _TicksToTime($NextRun,$NextHH,$NextMM,$NextSS) setStatusMsgNext(""&$NextHH&":"&$NextMM&":"&$NextSS) _DebugConsole("WAKESECS:"&$intWakeupTime&":NOWSECS:"&$intNow&":TICKSNEXT:"&$NextRun) if $intNow = $intWakeupTime Then SoundPlay(@WindowsDir & "\media\tada.wav",0) if $RunType = "GUI" Then wol_selected() Else wol_all() EndIf select case $RunType = "COMMANDLINE" Select case $CommandlineCompleteCommand="EXIT" Exit case Else ;~ RESTART $boolTimerActive=1 DisableControls(1) sleep(500) EndSelect case else ;~ GUI EndSelect EndIf EndFunc ; =================================================================== ; Function: FillTimeCombos ; filling the controls with data ; =================================================================== func FillTimeCombos() for $i=1 to 9 GUICtrlSetData($mvinpWakeupTimeHH,"0"&$i) GUICtrlSetData($mvinpWakeupTimeMM,"0"&$i) GUICtrlSetData($mvinpWakeupTimeSS,"0"&$i) Next for $i=10 to 23 GUICtrlSetData($mvinpWakeupTimeHH,$i) Next for $i=10 to 59 GUICtrlSetData($mvinpWakeupTimeMM,$i) GUICtrlSetData($mvinpWakeupTimeSS,$i) Next EndFunc ; =================================================================== ; Function: readmacfile ; reads mac list in ini format ; =================================================================== func readmacfile($filemaclist="MACLIST.DAT") if FileExists($filemaclist) Then $aMaclist=IniReadSection(@scriptdir&"\"&$filemaclist,"MACLIST") _GUICtrlListView_DeleteAllItems($mwlvMacadresses) for $i = 1 to $aMaclist[0][0] GUICtrlCreateListViewItem(""&$aMaclist[$i][1]&"|"&$aMaclist[$i][0]&"", $mwlvMacadresses) Next EndIf EndFunc ; =================================================================== ; Function: getmacinrange ; simple try to get all mac adresses from a given range (only last segment) ; =================================================================== func getmacinrange() FileDelete(@ScriptDir&"\"&$filemaclist) $aIpStart=StringSplit(GUICtrlRead($mvinpIpStart),".") $aIpStop=StringSplit(GUICtrlRead($mvinpIpStop),".") for $IpSegD = $aIpStart[4] to $aIpStop[4] get_mac($aIpStart[1]&"."&$aIpStart[2]&"."&$aIpStart[3]&"."&$IpSegD) Next readmacfile() EndFunc ; =================================================================== ; Function: togglelistviewcheckboxes($listviewcontrol,$state) ; $listviewcontrol --- Handle of control ; unmark all entries in a list ; =================================================================== func togglelistviewcheckboxes($listviewcontrol,$state) for $i = 0 to _GUICtrlListView_GetItemCount($listviewcontrol) _GUICtrlListView_SetItemChecked($listviewcontrol,-1,$state) next EndFunc ; =================================================================== ; Function: wol_selected ; sents magic paket to the macadress selected in listview ; =================================================================== func wol_selected() local $SelectedMacEntries=0 local $SelectedNetworkAdapters=0 local $WOLSendCounter=0 for $i = 0 to _GUICtrlListView_GetItemCount($mwlvMacadresses) if _GUICtrlListView_GetItemChecked($mwlvMacadresses, $i) Then $SelectedMacEntries=$SelectedMacEntries+1 _DebugConsole("Adresses:"&$SelectedMacEntries) local $SelectedNetworkAdapters=0 for $j = 0 to _GUICtrlListView_GetItemCount($mwlvNetWorkAdapters) if _GUICtrlListView_GetItemChecked($mwlvNetWorkAdapters, $j) Then $SelectedNetworkAdapters=$SelectedNetworkAdapters+1 _DebugConsole("Adapters:"&$SelectedNetworkAdapters) local $macadress=_GUICtrlListView_GetItemText($mwlvMacadresses,$i) local $adapter =_GUICtrlListView_GetItemText($mwlvNetWorkAdapters,$j,1) wol_adapter($adapter,$macadress) _DebugConsole("WOL for MAC:"&$macadress&" on ADAP:"&$adapter) setStatusMsg("Check "&$macadress&" awake?") $WOLSendCounter=$WOLSendCounter+1 EndIf Next EndIf Next if $WOLSendCounter<>0 then msgbox(64,"WOLLE","Done",60) EndIf if $SelectedMacEntries=0 then msgbox(64,"WOLLE","Sorry, no MAC/Ip selected for WakeUp") EndIf if $SelectedNetworkAdapters=0 then msgbox(64,"WOLLE","Sorry, no Adapter for Broadcast selected") EndIf endfunc ; =================================================================== ; Function: wol_all ; ; =================================================================== func wol_all() togglelistviewcheckboxes($mwlvMacadresses,true) togglelistviewcheckboxes($mwlvNetWorkAdapters,true) wol_selected() endfunc ; =================================================================== ; Function: setStatusMsg($msgtext) ; $msg --- Message for status text ; =================================================================== func setStatusMsg($msgtext) GUICtrlSetData($mwlblStatus,"Status:"&$msgtext) endfunc ; =================================================================== ; Function: setStatusMsgNext($msgtext) ; $msg --- Message for status text ; =================================================================== func setStatusMsgNext($msgtext) GUICtrlSetData($mwlblStatusNext,"Next trigger in:"&$msgtext) endfunc ; =================================================================== ; Function: wol_adapter($adapter,$$macadress) ; $adapter --- is the ipadress of the adapter ; $macadress --- is the macadress ; =================================================================== func wol_adapter($adapter,$macadress) if $adapter <> "0.0.0.0" Then $IPADRESS = StringSplit($adapter,".") $Broadcast = $IPADRESS[1] & "." & $IPADRESS[2] & "." & $IPADRESS[3] & "." & "255" $String="" setStatusMsg("Sent WOL via "&$Broadcast&" for:"&$macadress) _DebugConsole("Sent WOL via "&$Broadcast&" for:"&$macadress) WOL($Broadcast,$macadress) EndIf EndFunc ; =================================================================== ; Function: WOL($Broadcast,$element) ; $Broadcast --- is ipadress of adapter with 255 at the End ; $MACAddress --- is the macadress ; =================================================================== ; Wake up on Lan Function (Open connection and broadcast to Lan) Func WOL($Broadcast,$MACAddress) UDPStartUp() $connexion = UDPOpen($Broadcast,7) UDPSend($connexion, GenerateMagicPacket($MACAddress)) UDPCloseSocket($connexion) UDPShutdown() EndFunc ; This function convert a MAC Address Byte (e.g. "1f") to a char Func HexToChar($strHex) Return Chr(Dec($strHex)) EndFunc ; This function generate the "Magic Packet" Func GenerateMagicPacket($strMACAddress) $MagicPacket = "" $MACData = "" For $p = 1 To 11 Step 2 $MACData = $MACData & HexToChar(StringMid($strMACAddress, $p, 2)) Next For $p = 1 To 6 $MagicPacket = HexToChar("ff") & $MagicPacket Next For $p = 1 To 16 $MagicPacket = $MagicPacket & $MACData Next Return $MagicPacket EndFunc ; =================================================================== ; Function: get_mac($remote_ip,$filemaclist) ; $remote_ip --- remote ip ; $filemaclist --- file in ini format ; enhanced by TheSovereign - skip local mac adress ; =================================================================== func get_mac($remote_ip,$filemaclist="MACLIST.DAT") Ping($remote_ip,200) if @error =0 Then $arpinfo = Run(@ComSpec & " /c ARP -a "&$remote_ip, @SystemDir, @SW_HIDE, 2) sleep(200) $output = StdoutRead($arpinfo, -1) $aOutputLine=StringSplit($output,@CRLF) If UBound($aOutputLine) > 5 Then ; <=== added so script doesn't choke when processing the IP for the computer it's running on $macadress=Stringmid($aOutputLine[7],25,17) $macadress=StringReplace($macadress,"-","") IniWrite(@ScriptDir&"\"&$filemaclist,"MACLIST",$remote_ip,$macadress) setStatusMsg("Found maclist "&$macadress) EndIf ; <=== and this one... Else setStatusMsg("Host "&$remote_ip&" not reachable") Return endif EndFunc ; =================================================================== ; Function: addNetworkAdapters2ListView() ; Adds all networkadapters to the listviw ; =================================================================== Func addNetworkAdapters2ListView() _GUICtrlListView_DeleteAllItems($mwlvNetWorkAdapters) for $i = 0 to Ubound($aNetWorkAdapters)-1 GUICtrlCreateListViewItem(""&$aNetWorkAdapters[$i][0]&"|"&$aNetWorkAdapters[$i][1], $mwlvNetWorkAdapters) Next _GUICtrlListView_SetColumnWidth($mwlvNetWorkAdapters,0,$LVSCW_AUTOSIZE) EndFunc ; =================================================================== ; Function: _getnetworkadapter() ; Get All Network adapters with WMI ; @IPAddressx does only support 4 ; Original : 99ojo http://www.autoitscript.com/forum/index.php?showtopic=107247&view=findpost&p=756774 ; =================================================================== ; WMI get only Adapter with ip settings ; If WMI fail or no adapter with ip settings Return 0 Func _getnetworkadapter () $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $found = False $strComputer = "localhost" $count = 0 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems If StringInStr ($objItem.IPAddress(0), ".") <> 0 Then ReDim $aNetWorkAdapters [$count + 1] [2] $aNetWorkAdapters [$count] [0] = $objItem.Caption ;corrected to $count $aNetWorkAdapters [$count] [1] = $objItem.IPAddress(0) ;corrected to $count $count += 1 $found = True EndIf Next Else Return 0 EndIf If Not $found Then Return 0 EndFunc ; =================================================================== ; Function: _DebugConsole() ; Simple Console Output ; =================================================================== Func _DebugConsole($strString) consolewrite(@HOUR&@MIN&@SEC&" :"&$strString&@LF) EndFuncWOLLE.AU3 Edited March 31, 2010 by Tankbuster Link to comment Share on other sites More sharing options...
meomeo192 Posted December 8, 2015 Share Posted December 8, 2015 Just need 2 computer on same LAN? Do i need configure at Router? Thank you. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 8, 2015 Moderators Share Posted December 8, 2015 @meomeo192, this thread is 9 years old, with code that was last updated in version 3.3.4.0, and an author that has not been active in 7 years. Do not hold your breath waiting for a response, or hoping the code is still 100% compatible with the latest version of AutoIt.As AutoIt is a constantly evolving and growing language, you are going to be much better off creating a new thread and explaining in detail what you are attempting to accomplish, as well as what issues you are running into. If you began your script based on code in this thread, you can even include a link to here for reference, but post the code you are currently using, so people aren't trying to guess at what you're doing. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now