Jump to content

Maintain focus on a particular GUI


Recommended Posts

Hi,

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

                             accordingly)

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

 

Link to comment
Share on other sites

  • Moderators

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!

Link to comment
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)
    _WinWaitActivate("Disk1","")
    Send("{DOWN}{UP}{APPSKEY}a")
    _WinWaitActivate("UnInstaller-v1","")
    Send("!n")
    ;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")
         Send("{TAB}{ENTER}")
    Else
        log_msg("No Existing installation")
    EndIf
    _WinWaitActivate("UnInstaller-v1 " & $full_build & " EB - Setup","")
    Send("!n")
    _WinWaitActivate("UnInstaller-v1 " & $full_build & " EB - Setup","")
    Send("{SPACE}{UP}{SPACE}{ALTDOWN}n{ALTUP}{TAB}{TAB}{SPACE}{ALTDOWN}n{ALTUP}{ALTDOWN}n{ALTUP}{ALTDOWN}i{ALTUP}{ALTDOWN}f{ALTUP}")
    WinWaitActive("UnInstaller-v1 " & $full_build & " EB - Setup","Setup Completed", 3000)
    Send("!f")
    _WinWaitActivate("Setup progress","")
    Send("{ENTER}")
    
EndFunc

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg == $in_button
            get_available_versions()
            in_generateVersionsInGui()
            disableRest()
            ;Exit
        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])
                                    install_client($array_available[$i])
                    log_msg("Installed " & $array_available[$i])
                                EndIf
                        Next
            ;Force reboot the machine
            If GUICtrlRead($check_reboot) == $GUI_CHECKED Then
                Shutdown(6)
            EndIf
        
    EndSelect

WEnd

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 ?

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