wesleyb Posted May 27, 2011 Share Posted May 27, 2011 So I'm writing scripts to do a few tests on my software, but I need to test it out on different operating systems. I already have a test setup, with different machines, running different versions of Windows. I'm running into an issue with mouse coordinates though. I'm having an issue with precise clicking, mainly to check/uncheck check boxes. I can do something like this code below, and on XP/Vista/7 it works great. However, I just started to test it out on Win Server 2008, and for some reason it misses the check box! It will click just slightly below the check box. WinWaitActive("My Software's Dialog") AutoItSetOption("MouseCoordMode", 0) ;Switch the mouse coord mode to be relative to window MouseClick("left", 25, 125, 1, 2) ;Left click on a check box in my software window I'm wondering if there's a theme selection in Server 2008 that will make it not get screwy with the mouse coords. I would really hate to have to do something like this below for every one of my mouse clicks, since it would take a really long time to make those changes: If @OSVersion == "WIN_2008" Then MouseClick("left", 25, 123, 1, 2) ;left click high Else MouseClick("left", 25, 125, 1, 2) ;for all other OS's EndIf Thanks in advance for your thoughts! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 27, 2011 Share Posted May 27, 2011 (edited) 1. Repeat previous answer. 2. Also try to avoid MouseClick() if possible (for obvious reasons). Look at ControlClick() and it's brethren to automate controls directly. 3. And it could be argumented that forcing a string comparison (see Operators in helpfile) on what already is 2 strings is superfluous.... You do know you are doing that, right? Edited May 27, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
sleepydvdr Posted May 27, 2011 Share Posted May 27, 2011 The position of the button could be different from one OS to another. It might even be affected if someone has their system set to a different DPI setting. How about using ControlClick instead of MouseClick? ControlClick("Form1", "", "[CLASS:Button; TEXT:Button1; Instance:1;]") #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
wesleyb Posted May 31, 2011 Author Share Posted May 31, 2011 1. Repeat previous answer.2. Also try to avoid MouseClick() if possible (for obvious reasons). Look at ControlClick() and it's brethren to automate controls directly.3. And it could be argumented that forcing a string comparison (see Operators in helpfile) on what already is 2 strings is superfluous.... You do know you are doing that, right?Thanks Admiral! Yeah I suppose I could swap them out for ControlClicks, which would allow me to optionally use mouse coordinates, or not at all. And I stick to using double equals just out of habit of coding, however superfluous, it still executes the way I want it to, but thanks for pointing it out anyway. 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