Sign in to follow this  
Followers 0
mikephn

How to check if a control is hidden?

4 posts in this topic

I'm automating the execution of a program. When it runs it does its thing, and then presents the results. Unfortunately, the only clear indication that it finished is that a WindowsForm10.STATIC text saying "Scanning" becomes hidden. In Window Info I can see the text moving from Visible Text to Hidden Text. However, I don't know how to tell if the control is hidden or not. How would you do it?

Alternatively, I could check if a button that allows to progress further becomes active (it's grayed out when its scanning). Is that any easier?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Please have a look at "ControlCommand".

Example:

$iVisible = ControlCommand ( "Your window title", "text in your window (optional)", controlID, "IsVisible")
Returns 1 if Control is visible, 0 otherwise.

"IsEnabled" returns 1 if Control is enabled, 0 otherwise.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

or

#include <GUIConstantsEx.au3>
    GUICreate("My GUI Button") 
    $Button_1 = GUICtrlCreateButton("Hide Button2", 10, 30, 100,30)
    $Button_2 = GUICtrlCreateButton("Button2",10,70,100,30)
    $Button_3 = GUICtrlCreateButton("Chike Button2 Is Hide",10,110,200,30)
    GUISetState() 
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
            GUICtrlSetState ($Button_2,$GUI_HIDE)
            Case $msg = $Button_3
            $state = WinGetState(GUICtrlGetHandle($Button_2), "")
            If BitAnd($state,2) Then
            MsgBox(0, "MSG", "Button2 is Not Hide")
             Else
             MsgBox(0, "MSG", "Button2 is Hide")
            EndIf
        EndSelect
    WEnd
Exit
Edited by wolf9228

صرح السماء كان هنا

 

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