ileandros Posted September 4, 2012 Share Posted September 4, 2012 Hi, Let me start showing u my script: Opt("MouseCoordMode", 2) $size = WinGetClientSize("test") $xratio = $size[0] / 1440 $yratio = $size[1] / 900 WinActivate("test") Sleep(100) MsClick("","","","left",1,380,330) Func MsClick($clickType, $xpos, $ypos, $xOff = 1, $yOff = 1, $clicks = 1, $speed = 4) $randX = $xpos - ($xOff * $xratio) $randY = $ypos - ($yOff * $yratio) ControlClick("test", "", "",$clickType,1,$randX,$randY) EndFunc ;==>MsClick So what i want to do it to use ControlClick as MouseClick command. I am definitly doing something wrong here but dont know what it is. I tried thousands ways and some worked but not accurated. This one works but whatever is the possition i set it click always at the same place Please take a loot Regards I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
BrewManNH Posted September 5, 2012 Share Posted September 5, 2012 The coordinates in the ControlClick function are the coordinates in the control that you want it to click. Also, the way you're calling the MsClick function is totally wrong for how you wrote it. Your $clicktype is the first parameter, but it looks like you're sending the button to click in the 4th parameter ($xOff), and you're sending it the X and Y parameters in the $yOff and $clicks parameter positions. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
ileandros Posted September 5, 2012 Author Share Posted September 5, 2012 Yeah i dont know why the f@@k i posted this code but i got a lot of tests here.Func MsClick($tittle, $text, $controlid, $clickType, $clicks = 1, $xpos = 1, $ypos = 1) $randX = $xpos * $xratio $randY = $ypos * $yratio ControlClick("test", "", "",$clickType,$clicks,$randX,$randY) EndFunc ;==>MsClickSo it should be this way. But why is it not accurated?My window is a maximized window without child windows or sth else.No ID nothing. But not adding the ID it works on the entire window.Does it start from the top left (0 x 0)? I guess not.So i just have to find out whats the diffenece between them and change the $randX/$randY to +/- depending on the difference since i want it for self use? I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Sarmistha Posted September 5, 2012 Share Posted September 5, 2012 Sometimes back i faced the similar kind of problem. Just Put AutoItSetOption("MouseCoordMode", 2) inside the function and it worked. but if your screen is maximize screen then you can use any spy tool to get the co-ordinate. Link to comment Share on other sites More sharing options...
ileandros Posted September 5, 2012 Author Share Posted September 5, 2012 Sometimes back i faced the similar kind of problem.Just Put AutoItSetOption("MouseCoordMode", 2) inside the function and it worked.but if your screen is maximize screen then you can use any spy tool to get the co-ordinate.Nah nevermind.I found the solution. I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
JohnOne Posted September 5, 2012 Share Posted September 5, 2012 It's traditional to post a solution to a problem if you find it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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