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)