2015-12-01 104 views
1

我想使用AutoIt來激活正在運行的RobotFramework RIDE窗口並按下停止按鈕。當使用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

在ToolbarWindow32控件上,您通常必須使用帶有SendCommandID選項的ControlCommand。這應該適合你。

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