Ajays Posted February 4, 2009 Share Posted February 4, 2009 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 Link to comment Share on other sites More sharing options...
Varian Posted February 4, 2009 Share Posted February 4, 2009 (edited) 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 February 4, 2009 by Varian Link to comment Share on other sites More sharing options...
Ajays Posted February 4, 2009 Author Share Posted February 4, 2009 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 Link to comment Share on other sites More sharing options...
Varian Posted February 4, 2009 Share Posted February 4, 2009 (edited) 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 February 4, 2009 by Varian Link to comment Share on other sites More sharing options...
shaj12 Posted February 12, 2009 Share Posted February 12, 2009 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 1EDIT: In short, define the MouseCoordMode BEFORE you use the functions requiring coordinatesThank you VarianYour code is workingThank you for all the helpRegards,Ajay Link to comment Share on other sites More sharing options...
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