Jump to content

How to control a GUI application running as windows service using AutoIt?


Recommended Posts

I have a GUI application running as a Windows service, and I want to control that using AutoIt. I am able to get the handle of GUI window and make it active by using WinGetHandle & WinActivate commands.But I am not able to control a ComboBox and Button. I am using the below script to do the intended task:

Local $hWnd1 = WinGetHandle ("UI Window", "")                  ;get the handle of the UI
WinActivate( $hWnd1 )                                              ;make it active
Sleep(2000)
ControlCommand($hWnd1,"","ComboBox1","ShowDropDown","")            ;show the dropdown of Combo box
Sleep(3000)
ControlCommand($hWnd1,"","ComboBox1","SelectString",'CollegeName') ;select the string from dropdown list
Sleep(2000)
ControlCommand($hWnd1,"","ComboBox1","HideDropDown","")            ;hide the dropdown of Combo box
Sleep(1000)
ControlClick($hWnd1,"","[CLASS:Button;TEXT:Submit;INSTANCE:1]")    ;click on 'Submit' button
Sleep(2000)

This code is just making the window active and exiting out of the program after sometime doing nothing else. Is this  problem occurring because it is running as windows service? If so, how can I send commands to my GUI controls? 
Please help me out soon.
PS: AutoIt Window Info is able to recognize each and every controls of GUI (including ComboBox & Button). I don't want to run my script as a windows service.

Link to comment
Share on other sites

Hi FireFox,

It doesn't give any error, but ControlCommand & ControlClick returns 0 (Classname used is provided by AutoIt Window Info tool).

I also tried using mouse coordinates to click on the button in the GUI as follows:

Local $MouseReturn = MouseClick("left", 600, 270, 1)
Sleep (2000)

This function returns 1, but the mouse cursor does not move at all.

Edited by G453
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...