Jump to content

Checking ControlClicks


zone97
 Share

Recommended Posts

So, I have a bit of code like this.

If WinActive("[CLASS:MsiDialogCloseClass]") and GUICtrlRead($Button1) = "Updating" Then
        ControlClick("[CLASS:MsiDialogCloseClass]","Program Ready","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button2")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button6")
        $Input1 = StringUpper(GUICtrlRead($Input1))
        Sleep(500)
        ControlSend("[CLASS:MsiDialogCloseClass]","Enter Installation Code","RichEdit20W1",$Input1)
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Enter Installation Code","RichEdit20W1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Enter Installation Code","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Click Next to install to this folder","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Ready to Modify the Program","Button3")
    EndIf

 

Whats the best way to check that the clicks (a) have happened and (b) at the end after the last one, I need to say close the program. But only after all the steps have been done. I know I could make each an if then statement with say a count up var., but just curious if there was a better way? Thanks.

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
Share on other sites

  • Moderators

@zone97 how about a little more information on the application or window? Does the application move to a new screen with each click, or are all your clicks on the same screen? If the latter, are the other buttons/controls grayed out until you click the previous? A screenshot would be enormously helpful.

"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

Its an application that uses the MSI installer platform. It never moves. Its just one window after the other. I'll provide some screen shots. You'll have to forgive the cloak and dagger of my screen captures. Anyway, my code seems to work on my machine, but I would like to add a bit more checks and balances so that it would work on most any machine no matter how fast or slow it take for the window to appear.  I also supplied the full code, but again, had to replace the names to protect the innocent.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Icons\installer.ico
#AutoIt3Wrapper_Outfile=..\Program\generic name installer.exe
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

If Not IsAdmin() Then
    FileDelete("generic name installer.ini")
EndIf

;+------------------------------------------------------+
;| Define variables                                     |
;+------------------------------------------------------+

Local $code   = IniRead("generic name installer.ini","installer","code","")
Local $button = IniRead("generic name installer.ini","installer","button","")

;+------------------------------------------------------+
;| Build form                                           |
;+------------------------------------------------------+

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 149, 198)
GUISetBkColor(0xC0C0C0)
$Radio1 = GUICtrlCreateRadio("Modify", 40, 32, 73, 17)
$Radio2 = GUICtrlCreateRadio("Repair", 40, 56, 73, 17)
$Radio3 = GUICtrlCreateRadio("Remove", 40, 80, 73, 17)
$Group1 = GUICtrlCreateGroup("Install Exist", 24, 16, 97, 89)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input1 = GUICtrlCreateInput($code, 24, 128, 97, 21)
$Label1 = GUICtrlCreateLabel("Install Code", 30, 110, 97, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Courier New")
$Button1 = GUICtrlCreateButton($button, 23, 160, 99, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUICtrlSetState($Label1,  $GUI_DISABLE)
GUICtrlSetState($Input1,  $GUI_DISABLE)

If NOT FileExists("C:\generic name6\generic name6.exe") Then
    For $I = $Radio1 To $Radio3
        GUICtrlSetState($I, $GUI_DISABLE) ; $GUI_DISABLE is needed to disable the control
    Next
    If FileExists(@UserProfileDir & "\Downloads\generic name6.exe") Then
        GUICtrlSetState($Label1,  $GUI_ENABLE)
        GUICtrlSetState($Input1,  $GUI_ENABLE)
        If GUICtrlRead($Button1) = "" Then
            GUICtrlSetData($Button1, "Install")
        EndIf
    Else
        GUICtrlSetData($Button1, "Download")
    EndIf
EndIf

If GUICtrlRead($Button1) = "" Then
    GUICtrlSetState($Button1, $GUI_DISABLE)
EndIf

;+------------------------------------------------------+
;| HotKeys                                              |
;+------------------------------------------------------+

HotKeySet("{Esc}", "Quit")

;+------------------------------------------------------+
;| Main Process                                         |
;+------------------------------------------------------+

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Quit()
        Case $Radio1
            GUICtrlSetState($Button1, $GUI_ENABLE)
            GUICtrlSetState($Label1,  $GUI_ENABLE)
            GUICtrlSetState($Input1,  $GUI_ENABLE)
            GUICtrlSetData($Button1, "Update")
        Case $Radio2
            GUICtrlSetState($Button1, $GUI_ENABLE)
            GUICtrlSetState($Label1,  $GUI_DISABLE)
            GUICtrlSetState($Input1,  $GUI_DISABLE)
            GUICtrlSetData($Button1, "Repair")
        Case $Radio3
            GUICtrlSetState($Button1, $GUI_ENABLE)
            GUICtrlSetState($Label1,  $GUI_DISABLE)
            GUICtrlSetState($Input1,  $GUI_DISABLE)
            GUICtrlSetData($Button1, "Remove")
        Case $Button1
            If GUICtrlRead($Button1) = "Download" Then
                Download()
                GUICtrlSetState($Label1,  $GUI_ENABLE)
                GUICtrlSetState($Input1,  $GUI_ENABLE)
                GUICtrlSetData($Button1, "Install")
            EndIf
            If GUICtrlRead($Button1) = "Install" Then
                If GUICtrlRead($Input1) <> "" Then
                    GUICtrlSetState($Button1, $GUI_DISABLE)
                    InstallWF()
                Else
                    MsgBox(16,"Blank","Install code cannot be blank!")
                EndIf
            EndIf
            If GUICtrlRead($Button1) = "Update" Then
                If GUICtrlRead($Input1) <> "" Then
                    GUICtrlSetState($Button1, $GUI_DISABLE)
                    UpdateWF()
                Else
                    MsgBox(16,"Blank","Install code cannot be blank!")
                EndIf
            EndIf
            If GUICtrlRead($Button1) = "Repair" Then
                GUICtrlSetState($Button1, $GUI_DISABLE)
                RepairWF()
            EndIf
            If GUICtrlRead($Button1) = "Remove" Then
                GUICtrlSetState($Button1, $GUI_DISABLE)
                RemoveWF()
            EndIf
    EndSwitch

    If $button = "Installing" or $button = "Updating" or $button = "Repairing" or $button = "Removing" Then
        GUICtrlSetState($Button1, $GUI_DISABLE)
        If NOT ProcessExists("generic name6.exe") Then
            Run(@UserProfileDir & "\Downloads\generic name6.exe")
        Else
            WinActivate("[CLASS:MsiDialogCloseClass]")
        EndIf
    EndIf

    ; Install process!
    If WinActive("[CLASS:MsiDialogCloseClass]") and GUICtrlRead($Button1) = "Installing" Then
        ControlClick("[CLASS:MsiDialogCloseClass]","Welcome to the generic name software","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","License Agreement","Button3")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","License Agreement","Button5")
        $Input1 = StringUpper(GUICtrlRead($Input1))
        Sleep(500)
        ControlSend("[CLASS:MsiDialogCloseClass]","Enter Installation Code","RichEdit20W1",$Input1)
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Enter Installation Code","RichEdit20W1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Enter Installation Code","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Click Next to install to this folder","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","The wizard is ready to begin installation","Button3")
    EndIf

    ; Update process!
    If WinActive("[CLASS:MsiDialogCloseClass]") and GUICtrlRead($Button1) = "Updating" Then
        ControlClick("[CLASS:MsiDialogCloseClass]","generic name for company","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button2")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button6")
        $Input1 = StringUpper(GUICtrlRead($Input1))
        Sleep(500)
        ControlSend("[CLASS:MsiDialogCloseClass]","Enter Installation Code","RichEdit20W1",$Input1)
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Enter Installation Code","RichEdit20W1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Enter Installation Code","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Click Next to install to this folder","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Ready to Modify the Program","Button3")
    EndIf
    ; Repair process!
    If WinActive("[CLASS:MsiDialogCloseClass]") and GUICtrlRead($Button1) = "Repairing" Then
        ControlClick("[CLASS:MsiDialogCloseClass]","generic name for company","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button3")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button6")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Ready to Repair the Program","Button3")
    EndIf
    ; Remove process!
    If WinActive("[CLASS:MsiDialogCloseClass]") and GUICtrlRead($Button1) = "Removing" Then
        ControlClick("[CLASS:MsiDialogCloseClass]","generic name for company","Button1")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button4")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Repair installation errors in the program","Button6")
        Sleep(500)
        ControlClick("[CLASS:MsiDialogCloseClass]","Remove the Program","Button1")
    EndIf
WEnd

;+------------------------------------------------------+
;| Functions Section                                    |
;+------------------------------------------------------+

Func Download()
    ProgressOn("Download", "Downloading generic name...", "0%")
    $url= "http://someurl.com/utilities/generic name6.exe" ;Set URL
    $folder = @UserProfileDir & "\Downloads\generic name6.exe" ;Set folder
    $hInet = InetGet($url, $folder, 1, 1) ;Forces a reload from the remote site and return immediately and download in the background
    $FileSize = InetGetSize($url) ;Get file size
    While Not InetGetInfo($hInet, 2) ;Loop until download is finished
        Sleep(500) ;Sleep for half a second to avoid flicker in the progress bar
        $BytesReceived = InetGetInfo($hInet, 0) ;Get bytes received
        $Pct = Int($BytesReceived / $FileSize * 100) ;Calculate percentage
        ProgressSet($Pct, $Pct & "%") ;Set progress bar
    WEnd
    ProgressOff()
EndFunc

Func InstallWF()
    IniWrite("generic name installer.ini","installer","button","Installing")
    IniWrite("generic name installer.ini","installer","code",GUICtrlRead($Input1))
    If Not IsAdmin() Then
        ShellExecute(@AutoItExe, "", "", "runas")
        ProcessClose(@AutoItPID)
        Exit
    EndIf
EndFunc

Func UpdateWF()
    IniWrite("generic name installer.ini","installer","button","Updating")
    IniWrite("generic name installer.ini","installer","code",GUICtrlRead($Input1))
    If Not IsAdmin() Then
        ShellExecute(@AutoItExe, "", "", "runas")
        ProcessClose(@AutoItPID)
        Exit
    EndIf
EndFunc

Func RepairWF()
    IniWrite("generic name installer.ini","installer","button","Repairing")
    If Not IsAdmin() Then
        ShellExecute(@AutoItExe, "", "", "runas")
        ProcessClose(@AutoItPID)
        Exit
    EndIf
EndFunc

Func RemoveWF()
    IniWrite("generic name installer.ini","installer","button","Removing")
    If Not IsAdmin() Then
        ShellExecute(@AutoItExe, "", "", "runas")
        ProcessClose(@AutoItPID)
        Exit
    EndIf
EndFunc

Func Quit()
    FileDelete("generic name installer.ini")
    Exit
EndFunc

 

msiexec_2016-11-02_09-59-20.jpg

msiexec_2016-11-02_10-00-06.jpg

msiexec_2016-11-02_10-00-57.jpg

msiexec_2016-11-02_10-01-32.jpg

msiexec_2016-11-02_10-02-03.jpg

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
Share on other sites

  • Moderators

If it is an InstallShield package, why on earth are you trying to manipulate the GUI rather than running it silently?

Edit: looking through your code you really spent a lot of time "anonymizing" information about the install unnecessarily. Not sure why you felt you had to go through all that.

Edited by JLogan3o13

"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

Well up until you mentioned it, I didn't know such a thing existed. Can't say I know everything.. Lol...I made it anonymous because don't exactly know how my company would feel about me giving out any information about software we use.. Better safe than sorry. But thank you for the heads up. After googling it, now all i have to do is figure out how to create the iss file and see how that works out for me. Although, it came too late, already spent 2 days making this app work.. (and it does.) So, either way, mission accomplished.

Update: After playing with the installer, it turns out the creation of the iss function seems to be disabled. So... Glad i put the effort into what i made..  But thanks for the info, Ill look for that in the future.

Edited by zone97
update x2

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
Share on other sites

  • Moderators

@zone97 Try this, launch the setup.exe on a test machine, click all the way through to the last screen (before you click the final Install button). With the window still open, look in your %temp% directory. Most often, the setup.exe is just a wrapper, and it will extract the MSI file to the temp directory. If this does not work for you and you are forced to automate the GUI, I would suggest looking at WinWait. While the Class will not change, the visible text on each page should. So you would do your control click and then, rather than a Sleep you would do something like this:

WinWait(<Class Name>, <Text on Next Page>, <number of seconds to wait>)

If it does not see the new window after the specified time frame you can assume the ControlClick failed and branch out from there with an If statement depending on how you want to handle it.

Edited by JLogan3o13

"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 is what I have already done, it seems to work fairly well. Don't know what pitfalls I might run into. But I have tested it on windows 7 and 10 and so far no hiccups.

; Install process!
    If WinActive($title) and GUICtrlRead($Button1) = "Installing" Then
        $step = 1
        $waiting = True
        Do
            If $step = 1 Then
                $findtext   = "Welcome to the application software"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 2 Then
                $findtext   = "License Agreement"
                $control    = "Button3"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 3 Then
                $findtext   = "License Agreement"
                $control    = "Button5"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 4 Then
                $findtext   = "Enter Installation Code"
                $control    = "RichEdit20W1"
                If ControlGetHandle($title,$findtext,$control) Then
                    $Input1 = StringUpper(GUICtrlRead($Input1))
                    ControlClick($title,$findtext,$control)
                    ControlSend($title,$findtext,$control,$Input1&"{Enter}")
                    $step += 1
                EndIf
            EndIf
            If $step = 5 Then
                $findtext   = "Click Next to install"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 6 Then
                $findtext   = "The wizard is ready"
                $control    = "Button3"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 7 Then
                $findtext   = "Click Finish to exit the wizard"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                    $waiting = False
                EndIf
            EndIf
            Sleep(500)
        Until $waiting = False
        Quit()
    EndIf

    ; Update process!
    If WinActive($title) and GUICtrlRead($Button1) = "Updating" Then
        $step = 1
        $waiting = True
        Do
            If $step = 1 Then
                $findtext   = "application for company"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 2 Then
                $findtext   = "Repair installation errors in the program"
                $control    = "Button2"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 3 Then
                $findtext   = "Repair installation errors in the program"
                $control    = "Button6"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 4 Then
                $findtext   = "Enter Installation Code"
                $control    = "RichEdit20W1"
                If ControlGetHandle($title,$findtext,$control) Then
                    $Input1 = StringUpper(GUICtrlRead($Input1))
                    ControlClick($title,$findtext,$control)
                    ControlSend($title,$findtext,$control,$Input1&"{Enter}")
                    $step += 1
                EndIf
            EndIf
            If $step = 5 Then
                $findtext   = "Click Next to install to this folder"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 6 Then
                $findtext   = "Ready to Modify the Program"
                $control    = "Button3"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 7 Then
                $findtext   = "Click Finish to exit the wizard"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                    $waiting = False
                EndIf
            EndIf
            Sleep(500)
        Until $waiting = False
        Quit()
    EndIf

    ; Repair process!
    If WinActive($title) and GUICtrlRead($Button1) = "Repairing" Then
        $step = 1
        $waiting = True
        Do
            If $step = 1 Then
                $findtext   = "application for company"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 2 Then
                $findtext   = "Repair installation errors in the program"
                $control    = "Button3"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 3 Then
                $findtext   = "Repair installation errors in the program"
                $control    = "Button6"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 4 Then
                $findtext   = "Ready to Repair the Program"
                $control    = "Button3"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If WinActive($title) and ControlGetHandle($title,"&OK","Button1") Then ; Click ok to reboot when done!
                ControlClick($title,"&OK","Button1")
            EndIf
            If $step = 5 Then
                $findtext   = "Click Finish to exit the wizard"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                    $waiting = False
                EndIf
            EndIf
            Sleep(500)
        Until $waiting = False
        Quit()
    EndIf

    ; Remove process!
    If WinActive($title) and GUICtrlRead($Button1) = "Removing" Then

        $step = 1
        $waiting = True
        Do
            If $step = 1 Then
                $findtext   = "application for company"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 2 Then
                $findtext   = "Repair installation errors in the program"
                $control    = "Button4"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 3 Then
                $findtext   = "Repair installation errors in the program"
                $control    = "Button6"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 4 Then
                $findtext   = "Remove the Program"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                EndIf
            EndIf
            If $step = 5 Then
                $findtext   = "Click Finish to exit the wizard"
                $control    = "Button1"
                If ControlGetHandle($title,$findtext,$control) Then
                    ControlClick($title,$findtext,$control)
                    $step += 1
                    $waiting = False
                EndIf
            EndIf
            Sleep(500)
        Until $waiting = False
        Quit()
    EndIf
WEnd

 

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
Share on other sites

I was wondering if the simple adaptation to the original script work for you

If WinActive("[CLASS:MsiDialogCloseClass]") And GUICtrlRead($Button1) = "Updating" Then
    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Program Ready")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Program Ready", "Button1")

    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Repair installation errors in the program")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Repair installation errors in the program", "Button2")

    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Repair installation errors in the program")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Repair installation errors in the program", "Button6")

    $Input1 = StringUpper(GUICtrlRead($Input1))
    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Enter Installation Code", "RichEdit20W1")
    ControlSend("[CLASS:MsiDialogCloseClass]", "Enter Installation Code", "RichEdit20W1", $Input1)

    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Enter Installation Code")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Enter Installation Code", "RichEdit20W1")

    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Enter Installation Code")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Enter Installation Code", "Button1")

    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Click Next to install to this folder")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Click Next to install to this folder", "Button1")

    WinWaitActive("[CLASS:MsiDialogCloseClass]", "Ready to Modify the Program")
    ControlClick("[CLASS:MsiDialogCloseClass]", "Ready to Modify the Program", "Button3")
EndIf

I hope the first If condition is OK to synchronize the inside

Link to comment
Share on other sites

  • Moderators

The only issue with that is it is going to wait forever for that next window. If he is using this as a compiled executable, he'll never know which step fails.

"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

5 hours ago, JLogan3o13 said:

The only issue with that is it is going to wait forever for that next window. If he is using this as a compiled executable, he'll never know which step fails.

During debugging I had the content of the only label on the form to change to "Step # x" as it was going through. IF it hung I knew to tweak that step.

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

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