Robotframework RIDE AutoIt控制按下Stop

时间:2015-12-01 18:11:15

标签: automation autoit robotframework

我正在尝试使用AutoIt激活正在运行的RobotFramework RIDE窗口,然后按停止按钮。使用AutoIt信息工具时,我发现“停止”按钮位于工具栏中。我在这里粘贴了该工具的输出:

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

从此输出可以看出,“停止”按钮具有命令ID 146.

就AutoIt脚本而言,我正在尝试以下方法:

WinActivate("RIDE - Security")
ControlClick("[CLASS:wxWindowClassNR]", "", "[CLASS:ToolbarWindow32; INSTANCE:1]", "Start")

我错过了什么或做错了什么?

谢谢!

1 个答案:

答案 0 :(得分:1)

在ToolbarWindow32控件上,您通常必须将ControlCommand与SendCommandID选项一起使用。这应该适合你。

$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")