Jump to content
Sign in to follow this  
Ajays

Mouseclick problem

Recommended Posts

Ajays

Hi,

When i write a script on window machine where some mouse click is required.

I use the function mouseclick and some coordinates like

MouseClick("Left",382,350,1,30)

but when i run the script on some other window machine with some different resolution.

Then the mouseclick function does'nt works, because the resolution has changed.

Mouseclick function clicks at some other coordinates.

Is there any solution for this problem.

Thanks,

Ajay

Share this post


Link to post
Share on other sites
Varian

Try

Opt('MouseCoordMode', 2)

From The Help File:

MouseCoordMode

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

Not sure if you need 0 or 2, but 1 wouldn't work on different resolutions

Edited by Varian

Share this post


Link to post
Share on other sites
Ajays

Try

Opt('MouseCoordMode', 2)

From The Help File:

MouseCoordMode

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

Not sure if you need 0 or 2, but 1 wouldn't work on different resolutions

That means

if i have to click some where in the left region then i would write the mouseclick like below

MouseClick("Left",382,350,1,30)

Opt("MousecoordMode", 2)

simply

Share this post


Link to post
Share on other sites
Varian

No..at the top of your script or in your function, you would FIRST set the MouseCoordMode. This tells any mouse movements how to behave.

You can change the modes within the script/function as often as you need, depending on how you need the mouse/click commands following it to behave. You can set it to Mode 1(default) at the top of the main script, but in a function you can redefine it to Mode 0 or 2..just make sure to set it back before leaving the function if the rest of the script needs it to work in Mode 1

EDIT: In short, define the MouseCoordMode BEFORE you use the functions requiring coordinates

Edited by Varian

Share this post


Link to post
Share on other sites
shaj12

No..at the top of your script or in your function, you would FIRST set the MouseCoordMode. This tells any mouse movements how to behave.

You can change the modes within the script/function as often as you need, depending on how you need the mouse/click commands following it to behave. You can set it to Mode 1(default) at the top of the main script, but in a function you can redefine it to Mode 0 or 2..just make sure to set it back before leaving the function if the rest of the script needs it to work in Mode 1

EDIT: In short, define the MouseCoordMode BEFORE you use the functions requiring coordinates

Thank you Varian

Your code is working

Thank you for all the help

Regards,

Ajay

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  

×