Jump to content
Sign in to follow this  
sakshi

MouseClick

Recommended Posts

sakshi

I am new to autoit and am having an issue

i want to move a mouse to particular tree structure in a active window and then click on it.

the window does not take keystrokes.

how to click via mouseclick or controlclick?

can anyone help?

Share this post


Link to post
Share on other sites
Xenobiologist

What program? Any chance to try it on my own?


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
hawky358

If the tree structure is always in the same place, then you can just use mouseclick() or controlclick() like you said.

If it's not, then most likely you'll need to identify the window/control/text which can be used to uniquely identify the tree structure and use relative coordinates.

You don't give much info or ask anything in particular so it's difficult to help.

The best I can do is say: Look at the help for mouseclick(), controlclick(), MouseCoordMode, ControlGetPos ... maybe others relating to control

Share this post


Link to post
Share on other sites
sakshi

the issue is that i need to click on a node of the tree which remains at a fixed position.

i used controlclick as

ControlClick("Administrator", "Datasbase", "[CLASS:SysTreeView32; INSTANCE:1]","right", 1, 358, 291)

but it does not work.

what is the error?

I have specified the coordinates which i got using AutoitWindowInfo.

if i use

WinWaitActive("Administrator")

MouseMove(290,245)

MouseClick("right")

then it works but i think the coordinates would change each time as cooordinates would be machine specific.

so how to make it robust to run on any machine?

Share this post


Link to post
Share on other sites
hawky358

What's the return from Controlclick()?

You can try to remove the "database" portion.

Can you post/link a screenshot with the AutoitWindowinfo locked on the tree?

The relative coordinates should remain the same if the window doesn't resize to a size that the tree can't be seen properly (YOu could Maximize before you begin, but that's another story. First get the click to work.)

Just btw, you can use MouseClick("Right",290,245), it moves the mouse before it clicks.

Share this post


Link to post
Share on other sites
sakshi

i am sending the screenshot take a look and please suggest appropriate way to click users node.

thanks.

http://mbf.me/HtBa

Share this post


Link to post
Share on other sites
hawky358

Hey

Your original code was pretty close

Try this. Note I used a left click, just check if the left click selects it then change it to right click.

Opt("Wintitlematchmode",2)
ControlClick("Administrator","","[CLASS:SysTreeView32; INSTANCE:1]","left",1,76,56)

If the right click doesn't bring up the context menu the you can either do the task with only left click (i.e. using the edit or file menu etc) or you can try this to simulate Shift+F10 after left click (I know you said it doesn't accept keystrokes, but just try and see)

Opt("Wintitlematchmode",2)
ControlClick("Administrator","","[CLASS:SysTreeView32; INSTANCE:1]","left",1,76,56)
ControlSend("Administrator","","[CLASS:SysTreeView32; INSTANCE:1]","+{F10}")

Edit: Next time just make the image a jpg instead of bmp please (150k vs 3mb)

Edited by hawky358

Share this post


Link to post
Share on other sites
sakshi

thank you it is working.

thanks a lot.......

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  

×