Jump to content

Wireshark Installer ControlClick does not work


Recommended Posts

Hi

I try to click the next button of the Wireshark installer. Although it finds the control the ControlClick does not work (no action):

Local $hWin, $hControl
    Local $iControls, $iLoop, $iUniqueControls
    Local $sClassList, $sClass, $sClassID
    Local $aiControlPos, $avUniqueControls[1][2]

    ; Determine that the window exists
    $hWin = WinGetHandle("Wireshark")

    ; Determine the control classes and total number of controls
    $sClassList = WinGetClassList($hWin)
    $iControls = StringLen($sClassList) - StringLen(StringReplace($sClassList, _
        @LF, ""))
        
    ReDim $avUniqueControls[$iControls][2]

    $iUniqueControls = 0
    While $sClassList
        $sClass = StringLeft($sClassList, StringInStr($sClassList, @LF) - 1)
        $sClassList = StringMid($sClassList, StringLen($sClass) + 2)
        $sClassID = ""
        
        For $iLoop = 0 To $iUniqueControls - 1
            If $avUniqueControls[$iLoop][0] = $sClass Then
                $avUniqueControls[$iLoop][1] += 1
                $sClassID = $sClass & $avUniqueControls[$iLoop][1]
                ExitLoop
            EndIf
        Next
        
        If Not($sClassID) Then
            $avUniqueControls[$iUniqueControls][0] = $sClass
            $avUniqueControls[$iUniqueControls][1] = 1
            $iUniqueControls += 1
            $sClassID = $sClass & "1"
        EndIf

        $test = ControlGetText($hWin, "", $sClassID);
        
        ; Next is later replaced by a list of possible buttons
        if StringInStr($test, "Next") Then
            
            ConsoleWrite("Found next " & @LF)
            
            WinActivate($hWin)
            WinWaitActive($hWin)
            
            ControlClick($hWin, "", $sClassID)
            
        EndIf
        
    WEnd

Please not I know that I can call the "Next" button directly with ControlClick, but I need a way to get all control texts and compare them against a known list.

Cheers

Joe

Edited by lJoel
Link to comment
Share on other sites

Good to see you found out the reason.

That looks rather complicated code for a ControlClick() and I am not sure of why you need a known list for comparison. Perhaps you could use install switches to do a silent install if it is suitable? Have a look half way down this page for the subsection titled of "2.8.1.4. Command line options". Looks like a standard NSIS installer to me in which you can use /S (must be uppercase for NSIS). :idea:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...