Jump to content

Creating an Unattended Software Install - how do I get my script recognize the GUI_UNCHECK


gloriags
 Share

Recommended Posts

Hi,

This is my 2nd day learning AutoIt.

My goal is to create an unattended software Install.  I have gotten my script to run and install the product.  But when I get to the final window, there is a checkbox activated to run the application.  I would like to uncheck the box and select finish.  The code does not seem to recognize the check box.  Will you assist me in what I may be missing. 

I have attached the final window of the install, I have tried using the various titles of the window within the CtrlSetState function hoping it will recognize the check box. Please refer to attachment. 

Here is part of the code.

#include <MsgBoxConstants.au3>

$STATE = "CHECKED"

If $STATE = "CHECKED"  then

   GUICtrlSetState ("Launch Roadview Workstation after the installer closes.", GUI_UNCHECKED)

   $STATE = "UNCHECKED"

EndIf

Send("!f"post-84876-0-32274300-1392911576_thumb.j)

Link to comment
Share on other sites

  • Moderators

What do you get if you use the AutoIt Window Info Tool (located in the same directory where you installed AutoIt) and hover over the checkbox? Does it show a Control ID or ClassName you can manipulate?

"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

This function will grab/set the state of the checkbox (click it for the helpfile):

ControlCommand

Try running this, while the window is open, and active (added a sleep to make sure you activate the window first), and send back the output:

#include <WinAPI.au3>
Sleep(5000)
Var_GetAllWindowsControls2("[ACTIVE]")
Func Var_GetAllWindowsControls2($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Loop
    Local $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=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $text & "]." & @CRLF)
        Else
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next
EndFunc

If it retruns nothing, then you will have to use pixel searches, or something...is this a java applet?

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.
Link to comment
Share on other sites

Why would you need to compile it to run it?

Also, it won't help.  That's a painted gui.  There are hooks available to get in, and manipulate controls on java, but it takes a lot of work...and time.

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.
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...