Sign in to follow this  
Followers 0
royalmarine

Interact with multiple windows that are hidden / not visible

1 post in this topic

Hi all,

I'm currently writing a script that will automate some work software.

The work software has 8 windows, all identical to each other. It's used to control physical dispensers. We want an easier way to interact with all of them at once.

So far, ye guys have been great to help me with the code. And it works! However, in order for it to work, the buttons need to be visible on the screen.

e.g. not minimized, other windows on top etc. And obviously, this would be one of the big hurdles for us to get over.

Here's the code.

My end goal is to run my program below full screen. <- I can do this part fine.

However, I can't get my program to interact with the software as the button is not visible on screen. 

I'd like the program to interact with the software that's either behind my GUI or minimized. Either or would be ideal.

Is this possible? I've read a lot into controlClick, but I'm not sure if it can work.

I've even looked at Decipher's code to create a hidden desktop, but it's slightly confusing to me..

Any suggestions, tips, code snippets that I could look at that could do what I'm planning?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#Include <Constants.au3>
#Include <StaticConstants.au3>

Global $iDispensers = 8, $aCheckbox[$iDispensers], $iCountChecked = 0
$Form1_1 = GUICreate("Dispenser Automation", 1000, 600, 0, 0)

$Button1 = GUICtrlCreateButton("INITIALIZE", 72, 512, 195, 89)

$Button2 = GUICtrlCreateButton("DISPENSE CONTINUE", 280, 512, 195, 89)
$Button3 = GUICtrlCreateButton("PISTON IN DISPENSE", 488, 512, 195, 89)
$Button4 = GUICtrlCreateButton("START TOGGLE PISTON", 696, 512, 195, 89)
$Button5 = GUICtrlCreateButton("STUFF", 904, 512, 195, 89)
$Button6 = GUICtrlCreateButton("EXIT", 1712, 1040, 195, 89)

For $i = 0 To $iDispensers - 1
    $aCheckbox[$i] = GUICtrlCreateCheckbox("Dispenser " & $i + 1, 72, ($i * 32) + 16, 97, 17)
Next
$CheckboxAll = GUICtrlCreateCheckbox("Enable/Disable all", 72, 272, 120, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $CheckboxAll
            $bCheckAll = _IsChecked($CheckboxAll)
            For $i = 0 To UBound($aCheckbox, 1) - 1
                If $bCheckAll Then
                    GUICtrlSetState($aCheckbox[$i], $GUI_CHECKED)
                Else
                    GUICtrlSetState($aCheckbox[$i], $GUI_UNCHECKED)
                EndIf
            Next
            
        Case $Button1

            For $i = 0 To UBound($aCheckbox, 1) - 1
                If _IsChecked($aCheckbox[$i]) Then
                    $iCountChecked += 1
                    ControlClick("test" & $i + 1 & ".map", "", "[NAME:buttonInit]")
                EndIf
            Next
            If $iCountChecked = 0 Then MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONWARNING), "Warning", "You must select at least one dispenser.", 10)

        Case $Button2

            For $i = 0 To UBound($aCheckbox, 1) - 1
                If _IsChecked($aCheckbox[$i]) Then
                    $iCountChecked += 1
                    ControlClick("test" & $i + 1 & ".map", "", "[NAME:buttonContinue]")

                EndIf

            Next
            If $iCountChecked = 0 Then MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONWARNING), "Warning", "You must select at least one dispenser.", 10)

        Case $Button3
        Case $Button4
        Case $Button5
        Case $Button6
            Exit
    EndSwitch
WEnd

Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

 

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  
Followers 0