mucitbey Posted December 20, 2019 Share Posted December 20, 2019 Hi, Can we see the ip information of the selected computer in the marked part of the picture?Thank you. expandcollapse popup#include <Array.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ListviewConstants.au3> #include 'MultiPing.au3' Opt("GUIOnEventMode", 1) Global $usText, $ipText Global $Win_X = 910, $Win_Y = 500 HotKeySet("{ESC}", "_Close") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $Gui = GUICreate("", $Win_X, $Win_Y, @DesktopWidth -$Win_X, @DesktopHeight -$Win_Y-40, $WS_POPUP) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close", $Gui) GUISetBkColor(0x000000) $listview = GUICtrlCreateListView($Gui, 5, 5, $Win_X - 10, $Win_Y - 60) GUICtrlSetFont(-1, 10, 800, 0, "Arial Narrow") GUICtrlSetStyle(-1, $LVS_ICON) GUICtrlSetBkColor(-1, $COLOR_SILVER) $LH = GUICtrlGetHandle($listview) $hImage = _GUIImageList_Create(45, 10) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 45, 10)) ; Yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 45, 10)) ; Red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 45, 10)) ; Green _GUICtrlListView_SetImageList($listview, $hImage, 0) $button1 = GUICtrlCreateButton("E X I T", 400, $Win_Y - 40, $Win_X - 800, 30) GUICtrlSetTip(-1, " Program Closed ") GUICtrlSetOnEvent(-1, "_Close") GUICtrlSetFont(-1, 22, 800, 0, "Arial Narrow") Global $Infou = GUICtrlCreateLabel("", 5, $Win_Y - 50, 150, 20) GUICtrlSetFont(-1, 12, 800, 0, "Arial Narrow") GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetTip(-1, "Selected PC Name") Global $Infop = GUICtrlCreateLabel("", 5, $Win_Y - 25, 150, 20) GUICtrlSetFont(-1, 12, 800, 0, "Arial Narrow") GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetTip(-1, "Selected PC IP") GUISetState(@SW_SHOW) $IPlist = _FileReadToArray_mod("TestList.txt") _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_AddArray($listview, $IPlist) _GUICtrlListView_EndUpdate($listview) While 1 Sleep(10) $fResult = _nPing($IPlist, 1, 0, 0, "_refresh") WEnd Func _Refresh($Params) _GUICtrlListView_SetItemImage($listview, $Params[5], 0) Sleep(40) If $Params[4] = -1 Then _GUICtrlListView_SetItemImage($listview, $Params[5], 1) _GUICtrlListView_EnsureVisible($listview, $Params[5]) Else _GUICtrlListView_SetItemImage($listview, $Params[5], 2) EndIf EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo If Not IsHWnd($listview) Then $hWndListView = GUICtrlGetHandle($listview) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $usText = _GUICtrlListView_GetItemText($hWndListView, DllStructGetData($tInfo, "Index")) $ipText = _GUICtrlListView_GetItemText($hWndListView, DllStructGetData($tInfo, "Index")) GUICtrlSetData($Infou, $usText) GUICtrlSetData($Infop, $ipText) ; <-- i couldn't do this part (to have a running code) Case $NM_RCLICK MsgBox(0,"$NM_RCLICK", "Right Click") ;_PcClose() Case $NM_DBLCLK MsgBox(0,"$NM_DBLCLK", "Double Left Click") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _PcClose() MsgBox(0, "TEST", $usText &@CRLF& $ipText) EndFunc Func _Close() Exit EndFunc Link to comment Share on other sites More sharing options...
Nine Posted December 20, 2019 Share Posted December 20, 2019 Hard to say since you didn't make a runable script. Mostly it will depends on $IPlist array structure. But it is clearly doable in some way. Make a true runable script that we can test on our own, we will find you a solution for sure. mucitbey 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mucitbey Posted December 20, 2019 Author Share Posted December 20, 2019 Quote Computer_01;192.168.160.1 Computer_02;192.168.160.2 Computer_03;192.168.160.3 Computer_04;192.168.160.4 Computer_05;192.168.160.5 Computer_06;192.168.160.6 Computer_07;192.168.160.7 Computer_08;192.168.160.8 Computer_09;192.168.160.9 Computer_10;192.168.160.10 TestList.txt I'm sorry I forgot to share the txt file instance. Link to comment Share on other sites More sharing options...
Nine Posted December 20, 2019 Share Posted December 20, 2019 Replace $ipText = _GUICtrlListView_GetItemText($hWndListView, DllStructGetData($tInfo, "Index")) by $ipText = $IPlist[DllStructGetData($tInfo, "Index")][1] mucitbey 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mucitbey Posted December 20, 2019 Author Share Posted December 20, 2019 (edited) 25 minutes ago, Nine said: Replace $ipText = _GUICtrlListView_GetItemText($hWndListView, DllStructGetData($tInfo, "Index")) by $ipText = $IPlist[DllStructGetData($tInfo, "Index")][1] You are wonderful, Nine master. Thank you so much. Edited December 20, 2019 by mucitbey Link to comment Share on other sites More sharing options...
mucitbey Posted December 21, 2019 Author Share Posted December 21, 2019 Hello again, Clicking on the empty space on the list (no object) gives the error below and terminates the GUI.Is there anyone who has a solution to this issue? $ipText = $IPlist[DllStructGetData($tInfo, "Index")][1] $ipText = $IPlist[^ ERROR Thanks in advance for the help. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2019 Developers Share Posted December 21, 2019 You forgot to show the actual error message, but assume it's something with subscripts&array meaning that the returned value of DllStructGetData($tInfo, "Index") is no a correct one that exists in the array. Jos mucitbey 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Nine Posted December 21, 2019 Share Posted December 21, 2019 (edited) Just check if it is outside boundaries. $ipText = DllStructGetData($tInfo, "Index") < 0 ? "" : $IPlist[DllStructGetData($tInfo, "Index")][1] Edited December 21, 2019 by Nine mucitbey 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mucitbey Posted December 21, 2019 Author Share Posted December 21, 2019 (edited) @Nine Thank you for your help. You're very good at solving problems. Edited December 21, 2019 by mucitbey 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