lJoel Posted May 1, 2010 Share Posted May 1, 2010 (edited) Hi I try to click the next button of the Wireshark installer. Although it finds the control the ControlClick does not work (no action): expandcollapse popupLocal $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 May 1, 2010 by lJoel Link to comment Share on other sites More sharing options...
lJoel Posted May 1, 2010 Author Share Posted May 1, 2010 Hi The reason was w7 (installer had higher privileges than the autoit script) Cheers Stefan Link to comment Share on other sites More sharing options...
MHz Posted May 2, 2010 Share Posted May 2, 2010 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). 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