Jump to content

Recommended Posts

Posted (edited)

Good day,

I have the following 2 scripts - one for install, and one for removal:

Spoiler
; -----------------------------------------------
#include <AutoItConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $iTimeOut = 100
; ---------------------
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"
; -----------------------------------------------
Install_GR5()
; -----------------------------------------------
Func Install_GR5()
    Local $sSrcPath1 = $sSrcAppInstallPathInstRegGR5
    Local $sSrcPath2 = $sSrcAppInstallPathGR5
    ; -----------------------------------------------
    ; Navigate through the dialogs
    Run($sSrcPath1)
    WinWaitActive("NI InstReg Guitar Rig 5 Setup")
    Send("{TAB}Sleep($iTimeOut){ENTER}")
    ; ---------------------
    Sleep($iTimeOut)
    Run($sSrcPath2)
    WinWaitActive("Native Instruments Guitar Rig 5 - InstallAware Wizard")
    Send("{ENTER 4}")
    ; ---------------------
    Sleep($iTimeOut)
    Send("{ALTDOWN}")
    Send("a")
    Send("{ALTUP}")
    Send("{ENTER}")
    ; ---------------------
    Sleep($iTimeOut)
    MouseClick($MOUSE_CLICK_LEFT, 776, 490, 1, 0)
    Send("{DOWN 2}{ENTER 2}")
    ; ---------------------
    ; Installation is now executed!
    Sleep($iTimeOut)
    Send("{TAB}{ENTER}{ENTER}")
    ; ---------------------
    ; Finish
    Sleep(17000)
    WinWaitActive("Native Instruments Guitar Rig 5 - InstallAware Wizard")
    Send("{ENTER}")
EndFunc   ;==>Install_GR5
; -----------------------------------------------

 

Spoiler
; -----------------------------------------------
#include <AutoItConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
RemoveApps()
; -----------------------------------------------
Func RemoveApps()
    RemoveGR5()
EndFunc   ;==>RemoveApps
; -----------------------------------------------
Func RemoveGR5()
    Local $sSrcPath = "C:\ProgramData\{DA31E3B5-AD7E-4759-A162-75CF964B70AC}\Setup.exe REMOVE = True MODIFY = FALSE"
    ; ---------------------
    Run($sSrcPath)
    Sleep(2000)
    Send("{ENTER}")
    Sleep(3000)
    Send("{ENTER}")
EndFunc   ;==>RemoveGR5
; -----------------------------------------------

 

My primary issue of concern is that I have to set "timers" for various sections, and during the removal script the final 'Finish" button is never clicked?!?

What am I doing wrong? Is ControlSend() preferred over Send()? Most of the applications that I am installing do require the focus!

As always...any assistance in this matter would be greatly appreciated!

Thank you all for your time!

Edited by mr-es335
Posted

Good day,

Not too sure if this solves my predicament here, but implementing "ControlClick" seems to make automation more  "stable".

Following is my updated script:

Spoiler
; -----------------------------------------------
#RequireAdmin
; -----------------------------------------------
#include <AutoItConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
AutoItSetOption("MouseCoordMode", 0)
; -----------------------------------------------
Global $iTimeOut = 100
; ---------------------
Global $sSrcAppInstallPath = "D:\App_Install\Digital_Audio\1_RMLLabs\Apps\SAC64.exe"
Global $sStartMenuTitle = "C:\Users\RML_User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Software Audio Console"
; -----------------------------------------------
Install_SAC()
; -----------------------------------------------
Func Install_SAC()
    Local $sSrcPath = $sSrcAppInstallPath
    ; -----------------------------------------------
    ; 1st dialog > Extract data...
    Run($sSrcPath)
    WinWait("WinZip Self-Extractor - SAC64.exe", "")
    WinActivate("WinZip Self-Extractor - SAC64.exe", "")
    ControlClick("WinZip Self-Extractor - SAC64.exe", "", "Button1")
    ; ---------------------
    ; 2nd dialog > SAC64 Setup...
    WinWait("Setup Utility - 2.8", "")
    WinActivate("Setup Utility - 2.8", "")
    ControlClick("Setup Utility - 2.8", "", "Button1")
    ; ---------------------
    ; 3rd dialog > NOTICE!
    WinWait("NOTICE", "")
    WinActivate("NOTICE", "")
    Send("{ENTER}")
    ; ---------------------
    ; 4th dialog > SAC64 Setup
    WinWait("Setup Utility - 2.8", "")
    WinActivate("Setup Utility - 2.8", "")
    ControlClick("Setup Utility - 2.8", "", "Edit1")
    Send("{SHIFTDOWN}+{HOME}+{SHIFTUP}")
    ControlCommand("Setup Utility - 2.8", "", "", "EditPaste", "C:\RML\SAC")
    ControlClick("Setup Utility - 2.8", "", "Button1")
    ; ---------------------
    ; 5th dialog > Setup will now...
    WinWait("Setup Utility - 2.8", "")
    WinActivate("Setup Utility - 2.8", "")
    ControlClick("Setup Utility - 2.8", "", "Button1")
    ; ---------------------
    ; 6th dialog > Thank You...
    WinWait("Setup Utility - 2.8", "")
    WinActivate("Setup Utility - 2.8", "")
    ControlClick("Setup Utility - 2.8", "", "Button1")
    ; ---------------------
    ; Exit Start Menu
    WinWait($sStartMenuTitle)
    WinWaitActive($sStartMenuTitle)
    WinClose($sStartMenuTitle)
EndFunc   ;==>Install_SAC
; -----------------------------------------------

 

Much thanks to "techwg" for his insights!

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