Jump to content
Sign in to follow this  
Qvintus

Teamviewer Extract Participants List

Recommended Posts

Qvintus

Hello AutoIT'ers

Me and my friend are using AutoIT as for controlling our Laptop connected up to a TV through Teamviewer.

So far I've made my script hide/unhide and start a meeting if none is active.

However we've run into a problem when we wanted to have the script let us give control rights.

I know how to send the ControlClick command but problem is hitting the right person....

I've tried to use ControlListView and tried to find text to that particular class when the meeting is ongoing,

however I just can't seem to extract the right information.

Anyone know a good way to some how extract the list of Participants in Teamviewer Meeting?

It would be much appreciated!

EDIT: Some screenshot of the scripts so you might get a general understanding

QmBc.PNG

ControlInfo from Participants box:

sJKW.PNG

Best Regards Qvintus

Edited by Qvintus

Share this post


Link to post
Share on other sites
Qvintus

*bump* nobody can guide me in the right direction?

Share this post


Link to post
Share on other sites
jdelaney

It's possible that's a window within a window?

Try this out, to see if you can grab (possible) nested controls

$hControl = ControlGetHandle("your window", "", "TVScrollWin1")
ConsoleWrite(WinGetClassList($hControl) & @CRLF)

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Qvintus

 

It's possible that's a window within a window?

Try this out, to see if you can grab (possible) nested controls

$hControl = ControlGetHandle("your window", "", "TVScrollWin1")
ConsoleWrite(WinGetClassList($hControl) & @CRLF)

 

Thanks a lot for the answer!

Sadly that return nothin' even though it would seem a button + more is part of that object.

I've tried

$hControl = ControlGetHandle("[CLASS:TV_ControlWin]", "", "TVScrollWin1")
ConsoleWrite(WinGetClassList($hControl) & @CRLF)
$hControl = ControlGetHandle("[CLASS:TV_ControlWin]", "", "[CLASS:TVScrollWin;INSTANCE:1]")
ConsoleWrite(WinGetClassList($hControl) & @CRLF)

However for some reason if I use this:

$hControl = ControlGetHandle("[CLASS:TV_ControlWin]", "", "[CLASS:TVScrollWin1]")
ConsoleWrite(WinGetClassList($hControl) & @CRLF)

It returns this list:

SciTEWindowContent
Scintilla
Scintilla
ToolbarWindow32
SciTeTabCtrl
SciTEWindowContent
Static
Edit
Button
SciTEWindowContent
Static
ComboBox
Edit
Button
Button
Button
Button
Button
Button
Button
Button
SciTEWindowContent
Static
ComboBox
Edit
Static
ComboBox
Edit
Button
Button
Button
Button
Button
Button
Button
Button
Button
msctls_statusbar32

 

Tried getting info from all Edit instances, however nothin' of use turned up.
Edited by Qvintus

Share this post


Link to post
Share on other sites
jdelaney

Yes, that's because the last one returns an invalid handle (""), which inside the WinGetClassList returns the class list of your active window (which was scite)

ControlGetHandle

Success: Returns the handle (HWND) value.

Failure: Returns "" (blank string) and sets @error to 1 if no window matches the criteria.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Qvintus

Yes, that's because the last one returns an invalid handle (""), which inside the WinGetClassList returns the class list of your active window (which was scite)

ControlGetHandle

Success: Returns the handle (HWND) value.

Failure: Returns "" (blank string) and sets @error to 1 if no window matches the criteria.

 

I see... Guess I'll be needing to get hardcore to sort this out then? :(

Share this post


Link to post
Share on other sites
jdelaney

try this out, you might get lucky:

#include <Array.au3>
#include <constants.au3>
#include <WinAPI.au3>

$hwnd = WinGetHandle("[CLASS:TV_ControlWin]")
If IsHWnd($hwnd) Then
    Var_GetAllWindowsControls($hwnd)
Else
    MsgBox(1,1,"can't find your window...try again with correct class")
EndIf

Exit
Func Var_GetAllWindowsControls($hCallersWindow)
;~  $giSubFunctionCounter += 1
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)

    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Loop
    $iCurrentClass = ""
    $iCurrentCount = 1
    $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)

        If IsArray($aPos) Then
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[" & $aPos[0] & "] YPos=[" & $aPos[1] & "] Width=[" & $aPos[2] & "] Height=[" & $aPos[3] & "] Text=[" & $text & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next

EndFunc   ;==>Var_GetAllWindowsControls
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
Qvintus

 

try this out, you might get lucky:

#include <Array.au3>
#include <constants.au3>
#include <WinAPI.au3>

$hwnd = WinGetHandle("[CLASS:TV_ControlWin]")
If IsHWnd($hwnd) Then
    Var_GetAllWindowsControls($hwnd)
Else
    MsgBox(1,1,"can't find your window...try again with correct class")
EndIf

Exit
Func Var_GetAllWindowsControls($hCallersWindow)
;~  $giSubFunctionCounter += 1
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)

    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Loop
    $iCurrentClass = ""
    $iCurrentCount = 1
    $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)

        If IsArray($aPos) Then
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[" & $aPos[0] & "] YPos=[" & $aPos[1] & "] Width=[" & $aPos[2] & "] Height=[" & $aPos[3] & "] Text=[" & $text & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next

EndFunc   ;==>Var_GetAllWindowsControls

 

Sadly no info I didn't have already :(

I appreciate your help greatly though, you've given me a great amount of ideas in getting info for future projects ^^

Anything else is welcome ofc! xD

Edit: Info I got out of it even though I doubt it will provide any useful info

Func=[Var_GetAllWindowsControls]: ControlCounter=[1] ControlID=[888] Handle=[0x003148E6] ClassNN=[ATL:01D1C6A81] XPos=[30] YPos=[91] Width=[0] Height=[0] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[2] ControlID=[68902512] Handle=[0x00661750] ClassNN=[ATL:01D376501] XPos=[30] YPos=[516] Width=[245] Height=[183] Text=[Please wait...].
Func=[Var_GetAllWindowsControls]: ControlCounter=[3] ControlID=[68902152] Handle=[0x002E25C8] ClassNN=[ATL:01D376502] XPos=[270] YPos=[866] Width=[180] Height=[135] Text=[Please wait...].
Func=[Var_GetAllWindowsControls]: ControlCounter=[4] ControlID=[187730544] Handle=[0x002827CA] ClassNN=[ATL:01D39E501] XPos=[30] YPos=[516] Width=[245] Height=[183] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[5] ControlID=[187730256] Handle=[0x001726A8] ClassNN=[ATL:01D39E502] XPos=[269] YPos=[865] Width=[182] Height=[165] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[6] ControlID=[126409848] Handle=[0x00242594] ClassNN=[ATL:01D3FBF81] XPos=[30] YPos=[291] Width=[245] Height=[153] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[7] ControlID=[10] Handle=[0x0035280A] ClassNN=[Edit1] XPos=[113] YPos=[124] Width=[162] Height=[20] Text=[m65-284-087].
Func=[Var_GetAllWindowsControls]: ControlCounter=[8] ControlID=[11] Handle=[0x002F2432] ClassNN=[Edit2] XPos=[30] YPos=[91] Width=[0] Height=[0] Text=[Password].
Func=[Var_GetAllWindowsControls]: ControlCounter=[9] ControlID=[666] Handle=[0x002C2722] ClassNN=[Static1] XPos=[30] YPos=[516] Width=[245] Height=[183] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[10] ControlID=[69337900] Handle=[0x00281D98] ClassNN=[TVScrollWin1] XPos=[30] YPos=[152] Width=[245] Height=[19] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[11] ControlID=[129859248] Handle=[0x00172342] ClassNN=[TVScrollWin2] XPos=[30] YPos=[516] Width=[245] Height=[183] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[12] ControlID=[129858080] Handle=[0x00670E4C] ClassNN=[TVScrollWin3] XPos=[30] YPos=[861] Width=[660] Height=[135] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[13] ControlID=[129858664] Handle=[0x009223AA] ClassNN=[TVScrollWin4] XPos=[30] YPos=[516] Width=[660] Height=[456] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[14] ControlID=[69337060] Handle=[0x005125B2] ClassNN=[TVWidget1] XPos=[30] YPos=[91] Width=[245] Height=[110] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[15] ControlID=[126498868] Handle=[0x001B286A] ClassNN=[TVWidget2] XPos=[30] YPos=[201] Width=[245] Height=[24] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[16] ControlID=[126409204] Handle=[0x001D494A] ClassNN=[TVWidget3] XPos=[30] YPos=[225] Width=[245] Height=[219] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[17] ControlID=[126435828] Handle=[0x002E27DE] ClassNN=[TVWidget4] XPos=[30] YPos=[444] Width=[245] Height=[24] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[18] ControlID=[126511260] Handle=[0x002122BC] ClassNN=[TVWidget5] XPos=[30] YPos=[468] Width=[245] Height=[24] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[19] ControlID=[126523052] Handle=[0x00211AF4] ClassNN=[TVWidget6] XPos=[30] YPos=[492] Width=[245] Height=[24] Text=[].
Func=[Var_GetAllWindowsControls]: ControlCounter=[20] ControlID=[127766740] Handle=[0x0051076C] ClassNN=[TVWidget7] XPos=[30] YPos=[516] Width=[245] Height=[24] Text=[].

Edited by Qvintus

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Ascer
      By Ascer
      1. Description.
      Udf working with MSDN System.Collections.ArrayList. Allow you to make fast operations on huge arrays, speed is even x10 better than basic _ArrayAdd.  Not prefered for small arrays < 600 items. 2. Requirements
      .NET Framework 1.1 - 4.5 (on this version Microsoft destroy old rules) System Windows 3. Possibilities.
      ;=============================================================================================================== ; UDF Name: List.au3 ; ; Date: 2018-02-17, 10:52 ; Description: Simple udf to create System Collections as ArrayList and make multiple actions on them. ; ; Function(s): _ListCreate -> Creates a new list ; _ListCapacity -> Gets a list size in bytes ; _ListCount -> Gets items count in list ; _ListIsFixedSize -> Get bool if list if fixed size ; _ListIsReadOnly -> Get bool if list is read only ; _ListIsSynchronized -> Get bool if list is synchronized ; _ListGetItem -> Get item on index ; _ListSetItem -> Set item on index ; ; _ListAdd -> Add item at end of list ; _ListClear -> Remove all list items ; _ListClone -> Duplicate list in new var ; _ListContains -> Get bool if item is in list ; _ListGetHashCode -> Get hash code for list ; _ListGetRange -> Get list with items between indexs ; _ListIndexOf -> Get index of item ; _ListInsert -> Insert a new item on index ; _ListInsertRange -> Insert list into list on index ; _ListLastIndexOf -> Get index last of item ; _ListRemove -> Remove first found item ; _ListRemoveAt -> Remove item in index ; _ListRemoveRange -> Remove items between indexs ; _ListReverse -> Reverse all items in list ; _ListSetRange -> Set new value for items in range ; _ListSort -> Sort items in list (speed of reading) ; _ListToString -> Get list object name ; _ListTrimToSize -> Remove unused space in list ; ; Author(s): Ascer ;=============================================================================================================== 4. Downloads
      List.au3 5. Examples
      SpeedTest _ArrayAdd vs ListAdd SpeedTest ArraySearch vs ListIndexOf Basic usage - crating guild with members  
    • nacerbaaziz
      By nacerbaaziz
      can we  create a list box with  Columns?
      welcome everybody
      Dears I have a question if you let me
      can we  create a list box with  Columns?
      i know we can create a list view with Columns
      but my question is about the list box
      I'm waiting your responses
      Thank you in advance
    • dascondor
      By dascondor
      So I having issues with this GUI/Listview. My main GUI works like it needs to but the ListView GUIs don't. The exit buttons do not work on them and om have a hard time getting them to work. And I'm trying to make the  listview GUI resizeable. But I'm not sure how to fix either of these issues any thoughts.
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <ScreenCapture.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListviewConstants.au3> #include 'MultiPing.au3' Opt("GUIOnEventMode", 1) #Region ;Declares ; Reads text file for the base list of IP's Global $aBase_IPlist = _FileReadToArray_mod(".\IP_List.txt") Global $replace2 = "Second" Global $replace3 = "Thrid" ;Global $userdata1 = GUICtrlRead($data1) ;Global $userdata2 = GUICtrlRead($data2) Global $savefolder = "C:\Users\" Global $paths = "\Desktop\PingChecks" Global $1stpaths = "\~~~Store" Global $2ndpaths = "~~~" Global $results = FileExists($savefolder & @UserName & $paths) ;Global $foldercheck = FileExists($savefolder & @UserName & $paths & $1stpaths & $userdata1 & $userdata2 & $2ndpaths) ;Global $savefile = "C:\Users\" & @UserName & "\Desktop\PingChecks\~~~Store" & $userdata1 & $userdata2 & "~~~\" #EndRegion ;Declares #Region ### START Koda GUI section ### Form= $IPMonkey = GUICreate("IP Monkey", 573, 254, -1, -1) GUISetIcon("C:\Users\Dlex\Pictures\monkeyicon.ico", -1) GUISetFont(16, 800, 0, "Arial") GUISetBkColor(0xFFFFFF) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") $data1 = GUICtrlCreateInput("1", 184, 120, 89, 32, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) GUICtrlSetColor(-1, 0x000000) $data2 = GUICtrlCreateInput("23", 280, 120, 89, 32, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) GUICtrlSetColor(-1, 0x000000) $GOButton = GUICtrlCreateButton("GO", 80, 192, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetTip(-1, "Runs A Live Continuous Ping" & @CRLF & _ "Until Told Other Wise") GUICtrlSetOnEvent(-1, "GOButtonClick") $quickscan = GUICtrlCreateButton("Quick Scan", 224, 192, 107, 25) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFFFF00) GUICtrlSetOnEvent(-1, "quickscanClick") GUICtrlSetTip(-1, "Quickly Scans, Then Saves" & @CRLF & _ "Results In Your 'PingChecks' " & @CRLF & _ "Folder Under Your Store Number Folder") Global $exitbutton = GUICtrlCreateButton("Exit", 416, 192, 75, 25) GUICtrlSetFont(-1, 12, 800, 0, "Arial") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1, "What Do You Think This Button Does?") GUICtrlSetOnEvent(-1, "exitbuttonClick") $titlebar = GUICtrlCreateLabel("IP Monkey", 16, 120, 107, 28) GUICtrlSetColor(-1, 0x000000) $Pic1 = GUICtrlCreatePic("C:\Users\Dlex\Pictures\monkeyicon-0.jpg", 16, 16, 100, 100) GUICtrlSetOnEvent(-1, "Pic1Click") $infobutton = GUICtrlCreateButton("?", 536, 8, 27, 25) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFF8000) GUICtrlSetTip(-1, "Unsure what to do?" & @CRLF & _ "This will get give you " & @CRLF & _ "the help for IP Monkey") GUICtrlSetOnEvent(-1, "infobuttonClick") $Whatstorelabel = GUICtrlCreateLabel("What Store?", 208, 56, 130, 28) GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### #Region ;ping gui ; ------ pinger GUI ------------------- Global $StopPing = 0 Local $Win_X = 1200, $Win_Y = 880 ; dimension of window Global $PingGui = GUICreate("IP Monkey", $Win_X, $Win_Y, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") Global $listview = GUICtrlCreateListView("", 10, 10, $Win_X - 20, $Win_Y - 40) GUICtrlSetFont(-1, 8) $button1 = GUICtrlCreateLabel("Hit Exit To Quit", 10, $Win_Y - 25, $Win_X - 20, 20, -1,$ES_CENTER) GUICtrlSetFont(-1, 10, 800) GUICtrlSetTip(-1, "exit") GUICtrlSetOnEvent(-1, 'SpecialEvents') GUICtrlSetStyle($listview, $LVS_ICON) ; + $LVS_NOLABELWRAP) GUISetState(@SW_HIDE) ; hidden at startup ; --------- end of pinger gui ------------- #EndRegion ;ping gui ; Generate colored square images $hImage = _GUIImageList_Create(30, 30) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 30, 30)) ; yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 30, 30)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 30, 30)) ; green _GUICtrlListView_SetImageList($listview, $hImage, 0) While 1 Sleep(100) WEnd Func exitbuttonClick() MsgBox(0,'0','0') Exit EndFunc ;==>exitbuttonClick Func GOButtonClick() $userdata1 = GUICtrlRead($data1) $userdata2 = GUICtrlRead($data2) ; pass the wanted new octet replace_And_Go($userdata1, $userdata2) ; generate a list of new IP and Go EndFunc ;==>GOButtonClick Func infobuttonClick() EndFunc ;==>infobuttonClick Func Pic1Click() EndFunc ;==>Pic1Click Func quickscanClick() $userdata1 = GUICtrlRead($data1) $userdata2 = GUICtrlRead($data2) replace_And_Go2($userdata1, $userdata2) EndFunc ;==>quickscanClick Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE _button1() Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE Case @GUI_CtrlId = $GUI_EVENT_MAXIMIZE EndSelect EndFunc ;==>SpecialEvents #Region ; Main_GO/Replace_and_GO #cs ############################## second script ############################################# ; this is to ping continuously a list of IP addresses, get and display ping result "live" ; it simulates the dos "ping -t" command but performed simultaneously on many IP ; presenting the results in a ListView highlighting not responding devices with a red box #ce Func replace_And_Go($s_2, $s_3) ; Create a new array wit a new list of IP according to passed second and third octet Local $aNew_IPlist = $aBase_IPlist For $i = 0 To UBound($aNew_IPlist) - 1 $aNew_IPlist[$i][1] = StringReplace(StringReplace($aBase_IPlist[$i][1], $replace2, $s_2), $replace3, $s_3) Next GUISetState(@SW_HIDE, $IPMonkey) GUISetState(@SW_SHOW, $PingGui) ; pass the new list to the pinger Main_GO($aNew_IPlist) GUISetState(@SW_HIDE, $PingGui) GUISetState(@SW_SHOW, $IPMonkey) EndFunc ;==>replace_And_Go Func Main_GO($IPlist) HotKeySet("{esc}", "exitbuttonClick") $StopPing = 0 ; $IPlist = _FileReadToArray_mod(".\IP_List.txt") ; Reads text file for list of IP's ; ; the above command, it loads in the $IPlist array the values contained in the file IP_List.txt ; values in the file should be separated by a semicolon, something like in the following example: ; ; hostname1;192.168.0.1 ; hostname2;192.168.0.5 ; hostnameX;10.59.7.200 ; etc.... ; ; if values in the file are not separated by a semicolon, but another char is used, for example a comma, ; then just pass it as second parameter of the function: $IPlist = _FileReadToArray_mod(".\IP_List.txt", ",") ; _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_DeleteAllItems($listview) _GUICtrlListView_AddArray($listview, $IPlist) ; fill ListView _GUICtrlListView_EndUpdate($listview) While Not $StopPing ; 1 ; continuously ping addresses of the previously loaded file (IP_List.txt) Sleep(10) ; ; $IPlist is the array loaded with all the IP to be pinged (a 2d array in this case) ; | ; | 1 means the IP are in the second column of the $IPlist array (first colun is nr. 0) ; | | ; | | +--> 0 means return back an array loaded with results from all pinged addresses (responding and not responding) ; | | | if you use 1 then only responding addresses are loaded in the returned array [default] ; | | | if you use 2 then only NOT responding addresses are loaded in the returned array ; | | | In this case we do not need an array to be returned, we only need to perform all pings and pass results ; | | | directly (on the fly) to the "_refresh" callback function that will refresh the listview ; | | | ; | | | 0 means NO lookup name resolution must be performed ; | | | | ; | | | | +--> this is the callback function to be called for each pinged address each time the ping has finished ; | | | | | (see the MultiPing.au3 file for info on all passed params) ; | | | | | 6 parameters are passed to this function, but only 2 are used by the called function in this case: ; | | | | | [4] roundtrip of the responding ping or -1 if IP is down ; | | | | | [5] Index (position) of this IP within the caller's passed array ; | | | | | ; v v v v v _nPing($IPlist, 1, 0, 0, "_refresh") WEnd EndFunc ;==>Main_GO #EndRegion ; Main_GO/Replace_and_GO #Region ; QuickScan/Replace_and_GO2 Func replace_And_Go2($s_2, $s_3) ; Create a new array wit a new list of IP according to passed second and third octet Local $aNew_IPlist = $aBase_IPlist For $i = 0 To UBound($aNew_IPlist) - 1 $aNew_IPlist[$i][1] = StringReplace(StringReplace($aBase_IPlist[$i][1], $replace2, $s_2), $replace3, $s_3) Next GUISetState(@SW_HIDE, $IPMonkey) GUISetState(@SW_SHOW, $PingGui) ; pass the new list to the pinger QuickRun($aNew_IPlist) GUISetState(@SW_HIDE, $PingGui) GUISetState(@SW_SHOW, $IPMonkey) EndFunc ;==>replace_And_Go2 Func QuickRun($IPlist) $userdata1 = GUICtrlRead($data1) $userdata2 = GUICtrlRead($data2) HotKeySet("{esc}", "_button1") Local $Win_X = 1200, $Win_Y = 880 ; dimension of window $PingGui = GUICreate("IP Monkey" & "~~~" & @UserName & "~~~" & "Store" & $userdata1 & $userdata2 & "~~~" & @MON & "." & @MDAY & "." & @YEAR & "~~~" & @HOUR & "." & @MIN, $Win_X, $Win_Y, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_button1", $PingGui) $listview = GUICtrlCreateListView("", 10, 10, $Win_X - 20, $Win_Y - 40) GUICtrlSetFont(-1, 8) GUICtrlSetStyle($listview, $LVS_ICON) ; + $LVS_NOLABELWRAP) ; Generate colored square images $hImage = _GUIImageList_Create(30, 30) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFFFF00, 30, 30)) ; yellow _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 30, 30)) ; red _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 30, 30)) ; green _GUICtrlListView_SetImageList($listview, $hImage, 0) $button1 = GUICtrlCreateButton("Exit", 10, $Win_Y - 25, $Win_X - 20, 20) GUICtrlSetTip(-1, "End of program") GUICtrlSetOnEvent(-1, "exitbuttonClick") GUISetState(@SW_SHOW) ;~ $IPlist = _FileReadToArray_mod(".\IP_List.txt") ; Reads text file for list of IP's _GUICtrlListView_BeginUpdate($listview) _GUICtrlListView_AddArray($listview, $IPlist) ; fill ListView _GUICtrlListView_EndUpdate($listview) ;While 1 ; perform Pings and update ListView by the "_refresh" callback function $aFinalResult = _nPing($IPlist, 1, 0, 0, "_refresh") ;~ _ArrayDisplay($aFinalResult) ;DirCheck() EndFunc ;==>QuickRun #EndRegion ; QuickScan/Replace_and_GO2 #Region ; Misc Funcs (network) Func _refresh($Params) ; this receive ping results and displays them in the ListView _GUICtrlListView_SetItemImage($listview, $Params[5], 0) ; set colour to Yellow Sleep(50) ; a little wait If $Params[4] = -1 Then ; Device not responding to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 1) ; set colour to RED _GUICtrlListView_EnsureVisible($listview, $Params[5]) ; Position view to this item Else ; Device responds to ping _GUICtrlListView_SetItemImage($listview, $Params[5], 2) ; set colour to GREEN EndIf EndFunc ;==>_refresh Func _button1() ; Button 1 clicked ;~ $StopPing = 1 Exit EndFunc ;==>_button1 #EndRegion ; Misc Funcs (network)  
      MultiPing.au3
      IP_List.txt
    • hcI
      By hcI
      Hello everyone !
      I was looking for a parameter to set a List. Not a ComboList in ReadOnly.
      I've already found a topic about The readonly on a ComboList :
      But nothing on List
      Does someone know how to ?..
    • Vivaed
      By Vivaed
      I am trying to read all the files in a folder, then whatever file is newest, keep only that one and delete the rest.
      Example files:  (these all have version numbers embedded in them, I dont want to rely on the file name)
      Faint.exe
      Faint-v2.0.exe
      Faint-v3.0.exe
      Faint-v4.0.exe
       
      What I have so far:
      #include <File.au3> RemoveOldFiles() ConsoleWrite(FileGetVersion("C:\WB Resources\FAINT_DONT_LINK_THESE\Faint-v4.0.0.exe") &@CRLF) Func RemoveOldFiles() Local $aFileList = _FileListToArray("C:\WB Resources\FAINT_DONT_LINK_THESE\", "*.exe",$FLTA_FILES) For $i = 0 To UBound($aFileList) - 1 $aFileVersion = FileGetVersion($aFileList[$i]) ConsoleWrite($aFileList[$i] & @CRLF) ConsoleWrite($aFileVersion & @CRLF) Next EndFunc OUTPUT: >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\bot\ownCloud\WellBeats\Delete Old Files\delete-test.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop 3 0.0.0.0 a.exe 0.0.0.0 b.exe 0.0.0.0 Faint-v4.0.0.exe 0.0.0.0 4.0.0.18 <-- This is the correct file version.... +>07:34:26 AutoIt3.exe ended.rc:0 +>07:34:26 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.6647 Not sure what I am missing here?
      Thanks!
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.