Jump to content

2 "auto" scripts, one works...the other does not!!


Go to solution Solved by ioa747,

Recommended Posts

Posted (edited)

Good day,

This situation is getting beyond "frustrating!!

I have two scenarios , 1) for installation of Guitar Rig 5, and 2) for uninstallation of Guitar Rig 5.

Here is the install script:

Spoiler
; -----------------------------------------------
; 5/26/2026 8:23:13 PM
; -----------------------------------------------
#include <AutoItConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("MouseCoordMode", 0)
; -----------------------------------------------
Global $iTimeOut = 100
Global $iExtTimeOut = 2000
; ---------------------
Global $sSrcAppInstallPathInstRegGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_GR5.exe"
Global $sSrcAppInstallPathGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\GuitarRig5\Setup.exe"
Global $sTitleGR5 = "Native Instruments Guitar Rig 5 - InstallAware Wizard"
; -----------------------------------------------
Install_GR5()
; -----------------------------------------------
Func Install_GR5()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegGR5
    Local $sSrcPath2 = $sSrcAppInstallPathGR5
    ; -----------------------------------------------
    ; 1st dialog > Add installation data...
    Run($sSrcPath1)
    WinWait("NI InstReg Guitar Rig 5", "")
    WinActivate("NI InstReg Guitar Rig 5", "")
    ControlClick("NI InstReg Guitar Rig 5", "", 6)
    ; ---------------------
    ; 2nd dialog > Welcome...
    Run($sSrcPath2)
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 3rd dialog > License Language Selection
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 4th dialog > License Agreement
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "", "Check")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 5th dialog > Custom Setup > Mouse Only!!
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    Sleep($iTimeOut)
    MouseClick($MOUSE_CLICK_LEFT, 72, 143, 1, 0)
    Sleep($iTimeOut)
    Send("{DOWN 2}{ENTER}")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 6th dialog > VST Plug-In Destination Folder
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 7th dialog > Begin installation...
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", " ")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 8th dialog > Finish
;~  Do
;~      Sleep($iTimeOut)
;~  Until ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    Do
        Sleep($iTimeOut)
    Until ControlCommand($sTitleGR5, "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    ; ---------------------
;~  WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
;~  WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
;~  ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "TButton2")
    ; ---------------------
    If WinExists($sTitleGR5) Then
        ConsoleWrite("Window exists" & @CRLF)
        WinWait($sTitleGR5, "")
        WinActivate($sTitleGR5, "")
        ControlClick($sTitleGR5, "", "TButton2")
    EndIf
    ; -----------------------------------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Install_GR5
; -----------------------------------------------

...and here is the uninstall script:

Spoiler
; -----------------------------------------------
; 5/26/2026 8:18:16 PM
; -----------------------------------------------
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("MouseCoordMode", 0)
; -----------------------------------------------
Global $iTimeOut = 100
Global $iExtTimeOut = 2000
; ---------------------
Global $sUninstallPathGR5 = "C:\ProgramData\{DA31E3B5-AD7E-4759-A162-75CF964B70AC}\Setup.exe REMOVE=TRUE MODIFY=FALSE"
Global $sTitleGR5 = "Native Instruments Guitar Rig 5 - InstallAware Wizard"
; -----------------------------------------------
Uninstall_GR5()
; -----------------------------------------------
Func Uninstall_GR5()
    Run($sUninstallPathGR5)
    ; -----------------------------------------------
    WinWaitActive($sTitleGR5, "")
    WinActivate($sTitleGR5, "")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 2nd dialog > Finish
    Do
        Sleep($iTimeOut)
    Until ControlCommand($sTitleGR5, "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    ; ---------------------
    If WinExists($sTitleGR5) Then
;~      ConsoleWrite("Window exists" & @CRLF)
        WinWait($sTitleGR5, "")
        WinActivate($sTitleGR5, "")
        ControlClick($sTitleGR5, "", "TButton2")
    EndIf
    ; ---------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Uninstall_GR5
; -----------------------------------------------

As can be observed, both scripts are very similar. The last dialog is also similar...the uninstall script works without issue. However, the install script stalls on the last dialog [$sTitleGR5] - requiring me to manually exit the final dialog.

I an literally at my "wits end" here. Thus ANY assistance in this matter would be greatly appreciated.

Note: Resiak1811 is the one that came up with the "Do-Loop" concept...which works great for the uninstall script, but again, not for the install script!

PS: I came up with the final "If,Then", idea - which works fine with the uninstall script, but NOT for the install script! Why??

Edited by mr-es335
  • mr-es335 changed the title to 2 "auto" scripts, one works...the other does not!!
Posted

Could this script be updated to accommodate the installation routines?

Following are the routines...

Spoiler
; -----------------------------------------------
; 6/30/2026 4:26:57 PM
; -----------------------------------------------
#include <AutoItConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("MouseCoordMode", 0)
; -----------------------------------------------
Global $iTimeOut = 100
Global $iExtTimeOut = 2000
; ---------------------
Global $sSrcAppInstallPathInstRegGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_GR5.exe"
Global $sSrcAppInstallPathGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\GuitarRig5\Setup.exe"
Global $sTitleGR5 = "Native Instruments Guitar Rig 5 - InstallAware Wizard"
; ---------------------
Global $sSrcAppInstallPathInstRegRammfire = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_Rammfire.exe"
Global $sSrcAppInstallPathRammfire = "D:\App_Install\Digital_Audio\2_GR5\Apps\Rammfire\Setup.exe"
; ---------------------
Global $sSrcAppInstallPathInstRegReflektor = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_Reflektor.exe"
Global $sSrcAppInstallPathReflektor = "D:\App_Install\Digital_Audio\2_GR5\Apps\Reflektor\Setup.exe"
; ---------------------
Global $sSrcAppInstallPathInstRegTraktors12 = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_Traktors12.exe"
Global $sSrcAppInstallPathTraktors12 = "D:\App_Install\Digital_Audio\2_GR5\Apps\Traktors12\Setup.exe"
; -----------------------------------------------
Install_NIApps()
; -----------------------------------------------
Func Install_NIApps()
    Install_GR5()
    Install_Rammfire()
    Install_Reflektor()
    Install_Traktors12()
EndFunc   ;==>Install_NIApps
; -----------------------------------------------
Func Install_GR5()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegGR5
    Local $sSrcPath2 = $sSrcAppInstallPathGR5
    ; -----------------------------------------------
    ; 1st dialog > Add installation data...
    Run($sSrcPath1)
    WinWait("NI InstReg Guitar Rig 5", "")
    WinActivate("NI InstReg Guitar Rig 5", "")
    ControlClick("NI InstReg Guitar Rig 5", "", 6)
    ; ---------------------
    ; 2nd dialog > Welcome...
    Run($sSrcPath2)
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 3rd dialog > License Language Selection
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 4th dialog > License Agreement
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "", "Check")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 5th dialog > Custom Setup > Mouse Only!!
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    Sleep($iTimeOut)
    MouseClick($MOUSE_CLICK_LEFT, 72, 143, 1, 0)
    Sleep($iTimeOut)
    Send("{DOWN 2}{ENTER}")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 6th dialog > VST Plug-In Destination Folder
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 7th dialog > Begin installation...
    WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", " ")
    WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "")
    ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 8th dialog > Finish
    Do
        Sleep($iTimeOut)
    Until ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    ; ---------------------
    If WinExists($sTitleGR5) Then
        ConsoleWrite("Window exists" & @CRLF)
        WinWait($sTitleGR5, "")
        WinActivate($sTitleGR5, "")
        ControlClick($sTitleGR5, "", "TButton2")
    EndIf
    ; -----------------------------------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Install_GR5
; -----------------------------------------------
Func Install_Rammfire()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegRammfire
    Local $sSrcPath2 = $sSrcAppInstallPathRammfire
    ; -----------------------------------------------
    ; 1st dialog > Add installation data...
    Run($sSrcPath1)
    WinWait("NI InstReg Rammfire Setup", "")
    WinActivate("NI InstReg Rammfire Setup", "")
    ControlClick("NI InstReg Rammfire Setup", "", 6)
    ; ---------------------
    ; 2nd dialog > Welcome...
    Run($sSrcPath2)
    WinWait("Native Instruments Rammfire - InstallAware Wizard", "")
    WinActivate("Native Instruments Rammfire - InstallAware Wizard", "")
    ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 3rd dialog > License Language Selection
    WinWait("Native Instruments Rammfire - InstallAware Wizard", "")
    WinActivate("Native Instruments Rammfire - InstallAware Wizard", "")
    ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 4th dialog > License Agreement
    WinWait("Native Instruments Rammfire - InstallAware Wizard", "")
    WinActivate("Native Instruments Rammfire - InstallAware Wizard", "")
    ControlCommand("Native Instruments Rammfire - InstallAware Wizard", "", "", "Check")
    ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 5th dialog > Custom Setup > Mouse Only!!
    WinWait("Native Instruments Rammfire - InstallAware Wizard", "")
    WinActivate("Native Instruments Rammfire - InstallAware Wizard", "")
    ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 6th dialog > Begin installation...
    WinWait("Native Instruments Rammfire - InstallAware Wizard", " ")
    WinActivate("Native Instruments Rammfire - InstallAware Wizard", "")
    ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 7th dialog > Finish
    Do
        Sleep($iTimeOut)
    Until ControlCommand("Native Instruments Rammfire - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    ; ---------------------
    WinWait("Native Instruments Rammfire - InstallAware Wizard", "")
    WinActivate("Native Instruments Rammfire - InstallAware Wizard", "")
    ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "TButton2")
    ; -----------------------------------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Install_Rammfire
; -----------------------------------------------
Func Install_Reflektor()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegReflektor
    Local $sSrcPath2 = $sSrcAppInstallPathReflektor
    Local $sMsgA = "Native Instruments Reflektor still running!"
    Local $sMsgB = "Native Instruments Reflektor installation...is now completed!"
    ; -----------------------------------------------
    ; 1st dialog > Add installation data...
    Run($sSrcPath1)
    WinWait("NI InstReg Reflektor Setup", "")
    WinActivate("NI InstReg Reflektor Setup", "")
    ControlClick("NI InstReg Reflektor Setup", "", 6)
    ; ---------------------
    ; 2nd dialog > Welcome...
    Run($sSrcPath2)
    WinWait("Native Instruments Reflektor - InstallAware Wizard", "")
    WinActivate("Native Instruments Reflektor - InstallAware Wizard", "")
    ControlClick("Native Instruments Reflektor - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 3rd dialog > License Language Selection
    WinWait("Native Instruments Reflektor - InstallAware Wizard", "")
    WinActivate("Native Instruments Reflektor - InstallAware Wizard", "")
    ControlClick("Native Instruments Reflektor - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 4th dialog > License Agreement
    WinWait("Native Instruments Reflektor - InstallAware Wizard", "")
    WinActivate("Native Instruments Reflektor - InstallAware Wizard", "")
    ControlCommand("Native Instruments Reflektor - InstallAware Wizard", "", "", "Check")
    ControlClick("Native Instruments Reflektor - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 5th dialog > Custom Setup > Mouse Only!!
    WinWait("Native Instruments Reflektor - InstallAware Wizard", "")
    WinActivate("Native Instruments Reflektor - InstallAware Wizard", "")
    ControlClick("Native Instruments Reflektor - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 6th dialog > Begin installation...
    WinWait("Native Instruments Reflektor - InstallAware Wizard", " ")
    WinActivate("Native Instruments Reflektor - InstallAware Wizard", "")
    ControlClick("Native Instruments Reflektor - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 7th dialog > Finish
    Do
        Sleep($iTimeOut)
    Until ControlCommand("Native Instruments Reflektor - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    ; ---------------------
    WinWait("Native Instruments Reflektor - InstallAware Wizard", "")
    WinActivate("Native Instruments Reflektor - InstallAware Wizard", "")
    ControlClick("Native Instruments Reflektor - InstallAware Wizard", "", "TButton2")
    ; -----------------------------------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Install_Reflektor
; -----------------------------------------------
Func Install_Traktors12()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegTraktors12
    Local $sSrcPath2 = $sSrcAppInstallPathTraktors12
    Local $sMsgA = "Native Instruments Traktors 12 still running!"
    Local $sMsgB = "Native Instruments Traktors 12 installation...is now completed!"
    ; -----------------------------------------------
    ; 1st dialog > Add installation data...
    Run($sSrcPath1)
    WinWait("NI InstReg Traktors 12 Setup", "")
    WinActivate("NI InstReg Traktors 12 Setup", "")
    ControlClick("NI InstReg Traktors 12 Setup", "", 6)
    ; ---------------------
    ; 2nd dialog > Welcome...
    Run($sSrcPath2)
    WinWait("Native Instruments Traktors 12 - InstallAware Wizard", "")
    WinActivate("Native Instruments Traktors 12 - InstallAware Wizard", "")
    ControlClick("Native Instruments Traktors 12 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 3rd dialog > License Language Selection
    WinWait("Native Instruments Traktors 12 - InstallAware Wizard", "")
    WinActivate("Native Instruments Traktors 12 - InstallAware Wizard", "")
    ControlClick("Native Instruments Traktors 12 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 4th dialog > License Agreement
    WinWait("Native Instruments Traktors 12 - InstallAware Wizard", "")
    WinActivate("Native Instruments Traktors 12 - InstallAware Wizard", "")
    ControlCommand("Native Instruments Traktors 12 - InstallAware Wizard", "", "", "Check")
    ControlClick("Native Instruments Traktors 12 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 5th dialog > Custom Setup > Mouse Only!!
    WinWait("Native Instruments Traktors 12 - InstallAware Wizard", "")
    WinActivate("Native Instruments Traktors 12 - InstallAware Wizard", "")
    ControlClick("Native Instruments Traktors 12 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 6th dialog > Begin installation...
    WinWait("Native Instruments Traktors 12 - InstallAware Wizard", " ")
    WinActivate("Native Instruments Traktors 12 - InstallAware Wizard", "")
    ControlClick("Native Instruments Traktors 12 - InstallAware Wizard", "", "&Next >")
    ; ---------------------
    ; 7th dialog > Finish
    Do
        Sleep($iTimeOut)
    Until ControlCommand("Native Instruments Traktors 12 - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled")
    ; ---------------------
    WinWait("Native Instruments Traktors 12 - InstallAware Wizard", "")
    WinActivate("Native Instruments Traktors 12 - InstallAware Wizard", "")
    ControlClick("Native Instruments Traktors 12 - InstallAware Wizard", "", "TButton2")
    ; For installations
    ; -----------------------------------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Install_Traktors12
; -----------------------------------------------

 

 

  • Solution
Posted
Func Install_GR5()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegGR5
    Local $sSrcPath2 = $sSrcAppInstallPathGR5
    ; -----------------------------------------------
    ; 1st dialog > Add installation data...
    Run($sSrcPath1)
    WinWait("NI InstReg Guitar Rig 5", "")
    WinActivate("NI InstReg Guitar Rig 5", "")
    ControlClick("NI InstReg Guitar Rig 5", "", 6)
    ; ---------------------
    ; 2nd dialog > Welcome...
    Run($sSrcPath2)
    WinWait($sTitleGR5, "")
    WinActivate($sTitleGR5, "")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 3rd dialog > License Language Selection
    WinWait($sTitleGR5, "")
    WinActivate($sTitleGR5, "")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 4th dialog > License Agreement
    WinWait($sTitleGR5, "")
    WinActivate($sTitleGR5, "")
    ControlCommand($sTitleGR5, "", "", "Check")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 5th dialog > Custom Setup > Mouse Only!!
    WinWait($sTitleGR5, "")
    WinActivate($sTitleGR5, "")
    Sleep($iTimeOut)
    MouseClick($MOUSE_CLICK_LEFT, 72, 143, 1, 0)
    Sleep($iTimeOut)
    Send("{DOWN 2}{ENTER}")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 6th dialog > VST Plug-In Destination Folder
    WinWait($sTitleGR5, "")
    WinActivate($sTitleGR5, "")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 7th dialog > Begin installation...
    Local $hWnd = WinWait($sTitleGR5, " ")
    ConsoleWrite("$hWnd=" & $hWnd & @CRLF) ; 🚧 first check

    WinActivate($sTitleGR5, "")
    ControlClick($sTitleGR5, "", "&Next >")
    ; ---------------------
    ; 8th dialog > Finish

    Local $hWnd, $iCtrlEnabled = 0

    Do
        Sleep($iTimeOut)
        Local $aList = WinList($sTitleGR5)

        ; Scan all windows with the same title
        For $i = 1 To $aList[0][0]
            $hWnd = $aList[$i][1]

            ; Check if the "Finish" button is enabled in this $hWnd
            $iCtrlEnabled = ControlCommand($hWnd, "", "[CLASS:TButton; TEXT:Finish]", "IsEnabled", "")
            If $iCtrlEnabled Then ExitLoop
        Next

    Until $iCtrlEnabled Or Not WinExists($sTitleGR5) ; Safety exit if window is closed manually

    ; ---------------------
    If WinExists($hWnd) Then
        ConsoleWrite("Window exists, $hWnd=" & $hWnd & @CRLF) ; 🚧 check is the same?
        WinActivate($hWnd, "")
        WinWait($hWnd, "")
        ControlClick($hWnd, "", "[CLASS:TButton; TEXT:Finish]")
    EndIf
    ; -----------------------------------------------
    Sleep($iExtTimeOut)
EndFunc   ;==>Install_GR5

Try it and let me know.

I know that I know nothing

Posted

Hello,

If as you say, "; 🚧 check is the same?"...then why do I still require this?

I really have NO idea what exactly is going on, but the scripts are rather "intermittent".
• Sometimes, the script stalls on Rammfire, most of the time, the script stalls on GR5!?!

With your offering ioa747, GR5 seems to have no issues anymore! So,":Thank you!"

Posted (edited)

My comment ; 🚧 check is the same?
was exactly an invitation for you to look at the SciTE console output.

If you check the two ConsoleWrite values from a successful run,
you will likely notice that the first $hWnd (from the 7th dialog)
is different from the final $hWnd (from the 8th dialog),
even though the window title ($sTitleGR5) remains exactly the same!

This is why your original script was "intermittent."

The installer destroys the old window and creates a brand-new one with the same title for the "Finish" step,
or it runs a sub-installer that spawns its own dialog.

Your old script was targeting the old, dead handle, or trying to click a "Finish" button that wasn't fully initialized or enabled yet.

By running the Do...Until loop with WinList and checking IsEnabled,
the script stops guessing.
It actively scans the system to grab the current, live window handle and waits for the exact moment the "Finish" button becomes active.

Take a look at your console output on the next run it will reveal exactly what was going on behind the scenes!

(Console Writes are just for seeing what's happening, then you don't need them and you can turn them off.)

Edited by ioa747

I know that I know nothing

Posted (edited)

😄 Don't be so hard on yourself!

You are improving. Recognizing that something is wrong and looking for the deeper reason is exactly how programming works.

Seeing those two different handles in the console is your "aha!" moment.
Now you know that Windows and installers can be deceptive they change the internal structures ($hWnd) while keeping the same mask (Title).

Glad it's working  now. 

Edited by ioa747

I know that I know nothing

Posted (edited)

I checked the uninstaller script you provided [Click_Me], and it would appear that the same situation occurs with the uninstalls!

How then can the same "logic" you proposed in the above installer script  [Click_Me], be applied to the uninstall script?

Q1: May I ask what is the purpose of Local $hWnd = WinWait($sWindowTitle, "", 15) ; 15 sec timeout?
Q2: What does the comment "<- ??" mean or imply in "Sleep(500) ; <- ??"?

Edited by mr-es335
Posted (edited)
10 hours ago, mr-es335 said:

Q1: May I ask what is the purpose of Local $hWnd = WinWait($sWindowTitle, "", 15) ; 15 sec timeout?

if you don't set a value to the timeout parameter
WinWait ( "title" [, "text" [, timeout = 0]] )
then it will wait forever (until the window appears)

so what is 15 sec in front of eternity

10 hours ago, mr-es335 said:

Q2: What does the comment "<- ??" mean or imply in "Sleep(500) ; <- ??"?

since we are in a Do...Until loop
the script inside the loop executes repeatedly until the Until condition kicks us out

so the Sleep(500) time delays the repetition
(each time it checks if the window has appeared)
the ?? means that I am not sure about 500

it could be 10 but for such a situation 500 is fine and comfortable

in the last script you had declared
Global $iTimeOut = 100, and I used this

the difference is that in the first with 500
it checks 2 times per second

while in the other with 100
it checks 10 times per second

Edited by ioa747

I know that I know nothing

Posted

ioa747,

Your response to: "Q1: May I ask what is the purpose of Local $hWnd = WinWait($sWindowTitle, "", 15) ; 15 sec timeout? "
• Noted, and understood...thanks!

Your response to: "Q2: Q2: What does the comment "<- ??" mean or imply in "Sleep(500) ; <- ??"? "
• Also noted, and understood...thanks!

Appreciated!!

Posted (edited)

Ioa747,

In your above comment [Click_Me], you noted why my original script was "intermittent."  

However, it would "appear" that the same issue occurs with the uninstall script you provided [Click_Me]!

Is it "possible" then...to apply the same "logic" from the GR5 installer script [Click_Me]:

1) First, to the rest of the 3 installer scripts?, and
2) Second,  to the 4 uninstall script?

Edited by mr-es335
Posted

I'm not sure I understand
because the link you gave me here uses the same logic as this

Then you mentioned
1) First, to the rest of the 3 installer scripts?, and
2) Second, to the 4 uninstall script?

What/where are these?

I know that I know nothing

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
×
×
  • Create New...