Sign in to follow this  
Followers 0
beans

Mouseclick events

4 posts in this topic

Hello All,

My first message on the board!

Found Autoit and was amaised at its capabilities and simplicity but as a starter struggling at even simplest thing I am trying to create.

I made a small window with a button which is when clicked suppose to trigger two successive mouse clicks in different parts of the screen.

Just moving cursor was easy enough and it went precisely where I wanted it to go relative my Autoit button window.

When it came to adding clicks to the script a different story:after moving cursor to the needed location it would click, but after that cursor would move to a different location relative the screen (not my button window).

Anyone has any idea on how to do successive clicks on the screen relative the autoit window?

here is bit of sript:

---------------------------------------

#include <GUIConstants.au3>

GUICreate ("button clicks",220,50)

Opt("GUICoordMode",2)

$Button_1 = GUICtrlCreateButton ("activeate 1", 10, 10, 80)

GUISetState () ; will display an dialog box with button

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

Opt("MouseCoordMode", 0)

MouseMove ( 50, 100 , 5 );move relative to window

Opt("MouseCoordMode", 0)

MouseClick ( "left" );click

MouseMove ( 100, 100 , 3 );move to to second location

EndSelect

Wend

-----------------------------------------

Share this post


Link to post
Share on other sites



Try MouseCoordMode from the Help file :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try MouseCoordMode from the Help file :)

Hi NutherNoob,

This is what I tried in the script. Is there any other way that MouseCoordMode can be used that fixes the issue?

Edited by beans

Share this post


Link to post
Share on other sites

Found the solution. I used WinActivate command since mouse calculates its coordinates from active window!

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  
Followers 0