Jump to content

On desktop and select an option


vela
 Share

Recommended Posts

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

post-50843-1245266941_thumb.jpg

Link to comment
Share on other sites

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 by dantay9
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 by electrico
Link to comment
Share on other sites

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?

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