Jump to content
Sign in to follow this  
G453

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

Recommended Posts

G453

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.

Share this post


Link to post
Share on other sites
FireFox

Hi,

What do the functions return? (return value and @error)

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
G453

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

Share this post


Link to post
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
Sign in to follow this  

×