I am trying to use AutoIt to activate a running RobotFramework RIDE window and press the stop button. When using the AutoIt info tool I find that the Stop button is located within a toolbar. I have pasted the output from that tool here:
>>>> Window <<<<
Title: RIDE - Security
Class: wxWindowClassNR
Position: 665, 0
Size: 935, 860
Style: 0x16CF0000
ExStyle: 0x00000100
Handle: 0x0002052E
>>>> Control <<<<
Class: ToolbarWindow32
Instance: 1
ClassnameNN: ToolbarWindow321
Name:
Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:1]
ID:
Text:
Position: 304, 79
Size: 615, 28
ControlClick Coords: 45, 14
Style: 0x52001101
ExStyle: 0x00000000
Handle: 0x0003047A
>>>> Mouse <<<<
Position: 1022, 143
Cursor ID: 0
Color: 0xB6DBEE
>>>> StatusBar <<<<
1:
>>>> ToolsBar <<<<
1: 145 Start
2: 146 Stop
3: 147 Pause
4: 148 Continue
5: 149 Next
6: 150 Step over
From this output it can be seen that the Stop button has a Command ID 146.
In terms of an AutoIt script I am trying the following:
WinActivate("RIDE - Security")
ControlClick("[CLASS:wxWindowClassNR]", "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "Start")
What am I missing or doing incorrectly?
Thanks!
On ToolbarWindow32 controls you usually have to use ControlCommand with the SendCommandID option. This should work for you.
$hWinHandle = WinGetHandle("RIDE - Security")
;make sure we have focus
ControlFocus($hWinHandle, "", "[CLASS:ToolbarWindow32; INSTANCE:1]")
;uses the ControlCommand to access the stop
ControlCommand($hWinHandle, "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "SendCommandID", "146")
User contributions licensed under CC BY-SA 3.0