Service 如何使用AutoIt控制作为windows服务运行的UI应用程序?
我有一个作为Windows服务运行的UI应用程序,我想使用AutoIt来控制它。我可以通过Wingthandle和WinActivate命令获得UI窗口的句柄并使其处于活动状态。但我无法控制组合框和按钮。我正在使用以下脚本执行预期任务:Service 如何使用AutoIt控制作为windows服务运行的UI应用程序?,service,autoit,Service,Autoit,我有一个作为Windows服务运行的UI应用程序,我想使用AutoIt来控制它。我可以通过Wingthandle和WinActivate命令获得UI窗口的句柄并使其处于活动状态。但我无法控制组合框和按钮。我正在使用以下脚本执行预期任务: Local $hWnd1 = WinGetHandle ("UI Window", "") ;to get the handle of the UI WinActivate( $hWnd1 )
Local $hWnd1 = WinGetHandle ("UI Window", "") ;to get the handle of the UI
WinActivate( $hWnd1 ) ;to make it active
Sleep(2000)
ControlCommand($hWnd1, "", "ComboBox1", "ShowDropDown", "") ;to show the dropdown of Combo box
Sleep(3000)
ControlCommand($hWnd1, "", "ComboBox1", "SelectString", 'CollegeName') ;to select the string from dropdown list
Sleep(2000)
ControlCommand($hWnd1, "", "ComboBox1", "HideDropDown", "") ;to hide the dropdown of Combo box
Sleep(1000)
ControlClick($hWnd1, "", "[CLASS:Button; TEXT:Submit; INSTANCE:1]") ;to click on 'Submit' button
Sleep(2000)
这段代码只是使窗口处于活动状态,并在某个时候不做任何其他操作后退出程序。发生此问题是因为它作为windows服务运行吗?如果是,我如何向UI控件发送命令?请尽快帮我摆脱困境。
PS:AutoIt窗口信息能够识别UI的每个控件(包括组合框和按钮)。我不想将脚本作为windows服务运行。使用
#RequireAdmin
使用和玩
ControlCommand($hWnd1, "", "[ID:ComboBox1]", "ShowDropDown", "")
我在脚本的开头添加了#RequireAdmin
,但仍然存在相同的问题。还有其他建议吗?(仅供参考-我正在使用Windows7)ControlClick(“标题”、“文本”、controlID[,button=“left”[,clicks=1[,x[,y]]])