Jump to content
Sign in to follow this  

Maintain focus on a particular GUI

Recommended Posts


I am trying an simple installer script.

My Scenario :  1) run the script on remote server / local machine to install the software

                        2) script accesses a remote location to search for setup file -> starts installation

                        3) All works well as long as I do not click any other area on the desktop

                        4) Problem is as soon as a minimize the remote session, focus on the installer window is lost and script is stuck ( I am using WinWaitActive function to track the GUI events and send response


Any suggestion on how to keep the script running even if I minimize my remote session ?


Share this post

Link to post
Share on other sites

It sounds as you're using a lot of Mouseclicks, which need window focus (hard to tell since you didn't post any of your code). If this is indeed the case, look into using ControlSend or ControlClick, which will alleviate this issue. Or, better still, determine whether the application supports a silent install and do it that way.

"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!

Share this post

Link to post
Share on other sites

Hi JLogan3o13,

Here's what I am trying to do,

Func install_client($full_build)
    $winDirectory = "<ip-addr><main><sub1>" & $main_branch & "EB" & $full_build & "Disk1"
    Run("Explorer " & $winDirectory)
    ;Multiple installations of this application have been detected
    if WinWaitActive("UnInstaller-v1 " & $full_build & " EB", "Multiple installations", 5000) <> 0 Then
         log_msg("Existing installation Detected")
        log_msg("No Existing installation")
    _WinWaitActivate("UnInstaller-v1 " & $full_build & " EB - Setup","")
    _WinWaitActivate("UnInstaller-v1 " & $full_build & " EB - Setup","")
    WinWaitActive("UnInstaller-v1 " & $full_build & " EB - Setup","Setup Completed", 3000)
    _WinWaitActivate("Setup progress","")

While 1
    $msg = GUIGetMsg()
        Case $msg == $in_button
        Case $msg == $install_build
            ;$start = TimerInit()

            For $i = 1 to $total_available
                If GUICtrlRead($checkbox_available[$i]) == $GUI_CHECKED Then
                    log_msg("Installing " & $array_available[$i])
                    log_msg("Installed " & $array_available[$i])
            ;Force reboot the machine
            If GUICtrlRead($check_reboot) == $GUI_CHECKED Then


No Mouse clicks are involved here but only keyboard presses.

Is there any other way to simulate the button presses/ checkboxes/ radio buttons?

Also as you see, there are numerous windows in the installation process and I need to keep focus on these windows even if I minimize my remote session.

Any suggestion on how to do it / any alternative ?

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...