vela Posted June 17, 2009 Posted June 17, 2009 Hey folks, I am trying to create a script that will right click on a field in an application and then select an option from the list that pops up. Using the GUI, I can right click the correct field, but I cannot get the script to select an option from the popup. The AutoIt Windows Info tool, shows no content when I highlight this popup (except a handle). How can I get that handle without having the title, text, or controlID of the popup? Thanks, Vela Systems QA Intern P.S. I have attached a screen shot if you can't understand what I mean
dantay9 Posted June 17, 2009 Posted June 17, 2009 (edited) If you know the placement of the button you want to click, you can just use MouseGetPos() to find out where the right click took place. Then do MouseClick(). The x position is a certain amount of pixels right of the right click and the y position is a certain amount of pixels down from the right click position. Edited June 17, 2009 by dantay9
vela Posted June 17, 2009 Author Posted June 17, 2009 If you know the placement of the button you want to click, you can just use MouseGetPos() to find out where the right click took place. Then do MouseClick(). The x position is a certain amount of pixels right of the right click and the y position is a certain amount of pixels down from the right click position.Thank you for the suggestion. Unfortunately this script is going to be used by different people on different machines, so the window may not always be in the same place (making the mouse coords incorrect).I appreciate the post though!
PieMan Posted June 18, 2009 Posted June 18, 2009 Have you tried using the send() function? send a left arrow key etc to select the correct field? Its not the best way to do it but it works....
electrico Posted June 18, 2009 Posted June 18, 2009 (edited) Firstly, you can define your mouse coordinates, (screen resolution, in pixels must be same as in the pc where you made this script). Run This script and see what coordinates you have when the mouse cursoir is in the right position. And then run again previous script, move it again to the place of the window named "Form designer", define your window position, so mousemove function will not miss then, because WinMove will be used too. You have 3 seconds to move your mouse cursor to the place where right click and window location on the screen is expected. CODE Sleep (3000) $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) Then: ( the main code to automate your defined actions ) CODE WinWaitActive ("Form designer") WinMove ("Form designer", "", x, y) ; write the values that you got from previous codebox, accordingly. MouseMove (x,y) ; write the values that you got from previous codebox, accordingly. MouseClick ("right") Send ("{RIGHT}") Send ("{DOWN}") ; if you need to choose first variant of the submenu. If second, so Send down 2 times and so on... Send ("{Enter}") Thats should work fine. Edited June 18, 2009 by electrico
vela Posted June 18, 2009 Author Posted June 18, 2009 Firstly, you can define your mouse coordinates, (screen resolution, in pixels must be same as in the pc where you made this script). Run This script and see what coordinates you have when the mouse cursoir is in the right position. And then run again previous script, move it again to the place of the window named "Form designer", define your window position, so mousemove function will not miss then, because WinMove will be used too. You have 3 seconds to move your mouse cursor to the place where right click and window location on the screen is expected.I certainly appreciate the suggestion, and I do think that I will be able to implement it into my code. However, the other issue is that the variant of the submenu is a parameter that the user will input (ie it changes everytime), and the real kicker is the the submenu is not always the same either. Basically the script needs to be able to take an input parameter and find it on that submenu.Any suggestions?
vela Posted June 18, 2009 Author Posted June 18, 2009 Interestingly enough each of the submenu's has it's own unique handle and class number. Is there any way to use this class number to get the handle?
Zedna Posted June 20, 2009 Posted June 20, 2009 Look herehttp://www.autoitscript.com/forum/index.ph...st&p=591118Next time try to do some more searching :-) Resources UDF ResourcesEx UDF AutoIt Forum Search
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