Jump to content

How to record a button click action using AutoIT


Recommended Posts

Hi,

I have a java applet window on which i have two button. Without using the mouse coordinate, is there a way i can identify these button using AutoIT script and click the button as need? Two button do not have hard keys so i am unable to use my keyboard while recording the script.

Mouse coordinate are really tough to handle as the window is not at one position everytime it pop's up.

Appreciate your advice.

Thanks in advance.

Link to comment
Share on other sites

Thanks for your reply. Below is my code which i have used. First i click on the Browse Button on the popup window to select a file ( i used keyboard function to click the browser button, as the Browse button has shortcut key). As soon as i select the file two other button get enabled, however as the buttons do not have Shortcut key, i am using mouse coordinates. Both the buttons which get enabled on the popup window are always at the same location. Can you please advice, where and how i need to use the WinGetPos? I am new to AutoIT so i am not very clear on how the function. Appreciate your help.

WinWait ("Test Window","")

Sleep(10000)

WinActivate("Test Window","")

Send("{TAB}{ALTDOWN}b{ALTUP}")

WinWait ("Open","")

WinActivate("Open","")

Send("c:documents{SPACE}and{SPACE}settingstest{SPACE}test.doc{TAB}{TAB}{ENTER}")

Sleep(10000)

WinActivate("Test Window","")

Sleep(5000)

MouseMove(660,712)

MouseDown("left")

Sleep(100)

MouseUp("left")

Sleep(1000)

MouseMove(413,764)

MouseDown("left")

Sleep(100)

MouseUp("left")

WinActivate("Confirm","")

Send("{TAB}{ALTDOWN}n{ALTUP}")

Link to comment
Share on other sites

Look into ControlGetHandle, as well as 'Controls' section in the help file...save yourself headaches of mousemoves and send...as you have coded, the window must be in the same location, and the controls must never move.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Hi Abberation

I used the following line of code for WinGetPos in my above mentioned code but i see a an error "Subscript used with non array variable"

$size = WinGetPos("Name of the popup Window", "Button Name on the popup window")

The first parameter passed to the function is the Popup Window Name and the second is the name of the button on the popup window.

Can you pls advice?

Thanks in advance

Link to comment
Share on other sites

Hi Kevinsyle -

I used AutoIT Windows Info to capture the buttons on the window, however it wont capture the button info at all. Under controls i dont see buttons at all in the Window info.

Its displaying the class of whole info for the popup window but not displaying any button related info.

Can you please advice?

Thanks in advance

Link to comment
Share on other sites

  • Moderators

AutoIt Window Info works on windows created with the Windows API. As you are not seeing button info, this is not the case with the application you're trying to interact with. Have you taken a look at the JAVA UDF in the Examples section of the forum? It may offer some direction on what you're trying to do.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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