apt1706 Posted July 27, 2012 Share Posted July 27, 2012 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 More sharing options...
abberration Posted July 27, 2012 Share Posted July 27, 2012 With just what you told us, I would say take a look at WinActivate and WinGetPos. If the button is always at the same location within the popup window, you should be able to add a certain amount of pixels to the WinGetPos coordinates to click the button. triken3 1 Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Kevinsyel Posted July 27, 2012 Share Posted July 27, 2012 You might also be able to use the AutoIT Window Info application that comes bundled with AutoIT to find the "Class" of the button, then use that info in the "ControlClick" method Link to comment Share on other sites More sharing options...
apt1706 Posted July 27, 2012 Author Share Posted July 27, 2012 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 More sharing options...
jdelaney Posted July 27, 2012 Share Posted July 27, 2012 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 More sharing options...
apt1706 Posted July 29, 2012 Author Share Posted July 29, 2012 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 More sharing options...
apt1706 Posted July 31, 2012 Author Share Posted July 31, 2012 Can someone please advice on my query? Link to comment Share on other sites More sharing options...
apt1706 Posted August 3, 2012 Author Share Posted August 3, 2012 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 More sharing options...
Moderators JLogan3o13 Posted August 3, 2012 Moderators Share Posted August 3, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now