Jump to content

checking Button status in not Autoit GIU


 Share

Recommended Posts

Hi,

I am new to Autoit and will appreciate your help.

I'm writing an automation to test NOT Autoit GUI.

I have a problem to check if a button is checked. I only succeed to click on it (check/uncheck it), but I fail to check its status, using the return value of the command:

$res = ControlCommand ("[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl, "IsChecked" , "" )

The returned value is 0, even if the button is checked.

This is the code:

*******************

$hCtrl = ControlGetHandle ("[Class:WindowsForms10.window.8.app.0.378734a]", "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:27]" )

$Ctrl = "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:27]"

$hCtrl2 = ControlGetHandle ("[Class:WindowsForms10.window.8.app.0.378734a]", "","[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:26]")

$Ctrl2 = "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:26]"

WinWaitActive ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", 5 )

ControlEnable ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl2)

ControlFocus ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl2)

ControlEnable ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl)

ControlFocus ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl)

ControlGetFocus ("[Class:WindowsForms10.window.8.app.0.378734a]", "" )

$res = ControlCommand ("[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl, "IsChecked" , "" )

If @error == 1 Then

ConsoleWrite("error"&@LF)

EndIf

ConsoleWrite("$res = "&$res&@LF)

ControlEnable ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl)

$res = ControlCommand ("[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl, "Check", "" )

If @error == 1 Then

ConsoleWrite("error"&@LF)

EndIf

ConsoleWrite("$res = "&$res&@LF)

ControlEnable ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl)

$res = ControlCommand ("[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl, "IsChecked" , "" )

If @error == 1 Then

ConsoleWrite("error"&@LF)

EndIf

ConsoleWrite("$res = "&$res&@LF)

ControlEnable ( "[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl)

$res = ControlCommand ("[Class:WindowsForms10.window.8.app.0.378734a]", "", $Ctrl, "UnCheck", "" )

If @error == 1 Then

ConsoleWrite("error"&@LF)

EndIf

ConsoleWrite("$res = "&$res&@LF)

Link to comment
Share on other sites

What is the Au3Info of this button ?

Au3Info of this button:

>>>> Control <<<<

Class: WindowsForms10.BUTTON.app.0.378734a

Instance: 24

ClassnameNN: WindowsForms10.BUTTON.app.0.378734a24

Advanced (Class): [CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:24]

ID: 658432

Text: VCO

Position: 79, 144

Size: 51, 17

ControlClick Coords: 33, 12

Style: 0x5601000B

ExStyle: 0x00000000

Handle: 0x000A0C00

Link to comment
Share on other sites

I want to add the ControlCommand returns a value 0 and @error is not equal to 1.

I have tried other GUI functions to read the status of this control button, for example:

$hWnd = ControlGetHandle($win, $text, $ctrl_VCO)

ConsoleWrite("_GUICtrlButton_GetState = "&_GUICtrlButton_GetState($hWnd)&" $BST_PUSHED = "&$BST_PUSHED&@LF)

It returns:

_GUICtrlButton_GetState = 0 $BST_PUSHED = 4

Please help.

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