Guest Posted August 7, 2011 Share Posted August 7, 2011 (edited) How i can move the mouse to place by controlclick cords? For example look at that this code: ControlClick ("", "", "ui23Drawn_W327", "", "", 766, 27) This code refers to a specific location but it did not bring the mouse to this location. How to do mouse Moves to this position (with Function ControlClick And not with Function MouseMove) The Function MouseMove Always move the mouse to the same place which is not good. Thanks! Edited August 7, 2011 by Guest Link to comment Share on other sites More sharing options...
wakillon Posted August 7, 2011 Share Posted August 7, 2011 you must indicate title of the window. ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2011 Share Posted August 7, 2011 I know but I could not get the title of the window but it does not matter because it works just not move the mouse it's just clicking in the specific location but not move the mouse to this position. Link to comment Share on other sites More sharing options...
wakillon Posted August 7, 2011 Share Posted August 7, 2011 I know but I could not get the title of the window but it does not matter because it works just not move the mouse it's just clicking in the specific location but not move the mouse to this position.So, use MouseClick. AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2011 Share Posted August 7, 2011 So, use MouseClick.But it moves the mouse to a fixed location and that's not good when I move the window or changing resolution Link to comment Share on other sites More sharing options...
wakillon Posted August 7, 2011 Share Posted August 7, 2011 (edited) But it moves the mouse to a fixed location and that's not good when I move the window or changing resolution If you don't know his title or handle you can't use controlclick if not active. Mouseclick with Opt ( "MouseCoordMode", 0 ) ; relative coords to the active window. or ControlClick ("[active]", "", "ui23Drawn_W327", "", "", 766, 27) AutoI window Info Tools Return nothing ? Edited August 7, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2011 Share Posted August 7, 2011 If you don't know his title or handle you can't use controlclick.Mouseclick with Opt ( "MouseCoordMode", 0 ) ; relative coords to the active window.Can you give me a small example of that?Thanks Link to comment Share on other sites More sharing options...
wakillon Posted August 7, 2011 Share Posted August 7, 2011 I have edited my previous post, actualize your web page. If your window is active try the solution added. AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Guest Posted August 7, 2011 Share Posted August 7, 2011 (edited) No matter. Before you edit I tried to write something myself and it work out so I figured how to do it alone. That's what I tried: Opt ( "MouseCoordMode", 0 ) WinActivate("[CLASS:Notepad]", "") MouseMove(588, 283, 1) It works! Helped me a lot! I can get the inner window so no problem. Thank you very much! Edited August 7, 2011 by Guest Link to comment Share on other sites More sharing options...
Bert Posted August 7, 2011 Share Posted August 7, 2011 This would be more helpful if we knew what window you are working with. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Guest Posted August 18, 2011 Share Posted August 18, 2011 (edited) This would be more helpful if we knew what window you are working with.Apparently it did not work on the window I'm working with him.I did regular testing but not on that window ... This is the window:* The script can not read properly that window ..I do not know what to do .. Help me!Thanks Edited September 2, 2011 by Guest Link to comment Share on other sites More sharing options...
monoscout999 Posted August 18, 2011 Share Posted August 18, 2011 I got a demostration script about some controlcommands... look expandcollapse popup#include <winapi.au3> If not winexists("[Class:CalcFrame]") then ShellExecute("calc") ; if calc doesn`t exists, it run it. Winwait("[Class:CalcFrame]") ; waits until calc exists. $hndl = WinActivate("[Class:CalcFrame]") ; Active calc, and save the window handle in a variable. $pos = Controlgetpos("[Class:CalcFrame]","","[CLASS:Button; INSTANCE:5]") ; Get the position of the button "1". Msgbox(0,"Position of the button","Position of the control inside the clien area"&@CRLF _ &"The X coord of the control inside the client area is "&$pos[0]&@CRLF _ &"The Y coord of the control inside the client area is "&$pos[1]&@CRLF _ &"The width of the control is "&$pos[2]&@CRLF _ &"The height of the control is "&$pos[3]&@CRLF) ; -----------Preparating the Structure for the function call to get the absolute coords of the control ----------- $tPoint = DllStructCreate($tagPoint) ; The Struct tagPoint is alreade declared, it has two elements "x" and "y" DllStructsetdata($tPoint, "x",$pos[0]) ; I put in the element X of the structure the X pos of the control DllStructsetdata($tPoint, "y",$pos[1]) ; I put in the element Y of the structure the X pos of the control _WinAPI_ClientToScreen($hndl,$tPoint) ;~ Msgbox(0,"Position of the button","Absolute position of the control"&@CRLF _ ;~ &"The X coord of the control is "&DllStructgetdata($tPoint, "x")&@CRLF _ ;~ &"The Y coord of the control is "&DllStructgetdata($tPoint, "y")&@CRLF) ;IF YOU WANT TO SAVE THE DATA INTO VARIABLES YOU SHOULD DO THIS. $x = DllStructgetdata($tPoint, "x") $y = DllStructgetdata($tPoint, "y") $tPoint = 0 ; free the struct. Msgbox(0,"Position of the button","Absolute position of the control"&@CRLF _ &"The X coord of the control is "&$x&@CRLF _ &"The Y coord of the control is "&$y&@CRLF) mousemove($x, $y, 15) sleep(500) mousemove($x + $pos[2], $y + $pos[3], 15) sleep(500) MsgBox(0,"ControlSend","You can send the keys input directly to a control") ControlSend("[Class:CalcFrame]","","[CLASS:#32770; INSTANCE:1]","123456789") sleep(1000) ControlClick("[Class:CalcFrame]","","[CLASS:Button; INSTANCE:13]") sleep(1000) For $i = 1 to 9 ControlSend("[Class:CalcFrame]","","[CLASS:#32770; INSTANCE:1]",$i) sleep(500) Next sleep(500) ControlClick("[Class:CalcFrame]","","[CLASS:Button; INSTANCE:13]") sleep(500) MsgBox(0,"Non active window try","Now we gonna try to do this but with the window minimized") sleep(500) winsetstate("[Class:CalcFrame]","",@SW_MINIMIZE) sleep(500) For $i = 9 to 1 step -1 ControlSend("[Class:CalcFrame]","","[CLASS:#32770; INSTANCE:1]",$i) sleep(500) Next Msgbox(0,"It is the end","This is the end of the demostration, good look") KeyOne 1 Link to comment Share on other sites More sharing options...
nixnut Posted September 1, 2011 Share Posted September 1, 2011 (edited) Hello, this topic was very usefull to get replace a couple of mouseclicks with controlclicks. Controlclick is better for a specific location. Butt still some trouble occurs: http://imageshack.us/photo/my-images/705/fngaanbs.jpg/ Edited September 1, 2011 by nixnut Link to comment Share on other sites More sharing options...
nixnut Posted September 1, 2011 Share Posted September 1, 2011 I can't edit my previous post, whatever... Hello, this topic was very usefull to get replace a couple of mouseclicks with controlclicks. Controlclick is better for a specific location. Butt still some trouble occurs: I want to get the focus in the field wich is red. With the window info programm i get a classname etc, but when I run the script i can't get the focus in the specific field. I only get focus in the total grid where the field is in. I can use controlclick coordinates again but that doesn't work because the columns can be rearranged by drag and drop. The lay out is variable. Is it possible to get the focus in the particular field? Field info: >>>> Window <<<<Title: Onderhoud inkoop - Inkoopnummer: 4, Relatie: Gregal S. coopClass: LpVoFormPosition: -8, 7Size: 1616, 886Style: 0x96CF0000ExStyle: 0x00000100Handle: 0x0000000000010A36>>>> Control <<<<Class: LpVoEditControlInstance: 3ClassnameNN: LpVoEditControl3Name:Advanced (Class): [CLASS:LpVoEditControl; INSTANCE:3]ID:Text:Position: 607, 360Size: 99, 18ControlClick Coords: 56, 8Style: 0x56800000ExStyle: 0x00000000Handle: 0x0000000000010D88>>>> Mouse <<<<Position: 663, 423Cursor ID: 0Color: 0x000000>>>> StatusBar <<<<>>>> ToolsBar <<<< Link to comment Share on other sites More sharing options...
Guest Posted September 2, 2011 Share Posted September 2, 2011 I solved the problem. I did an idea that came to mind. And it works .. So it looks something like this: ControlClick ( "", "", "ui23Drawn_W327", "left", 1, 800, 13) $pos = Controlgetpos("","","") MouseClick("left", $pos[0] - 88, $pos[1] + 51, 2, 1) It works great Link to comment Share on other sites More sharing options...
monoscout999 Posted September 2, 2011 Share Posted September 2, 2011 I solved the problem. I did an idea that came to mind. And it works .. So it looks something like this: ControlClick ( "", "", "ui23Drawn_W327", "left", 1, 800, 13) $pos = Controlgetpos("","","") MouseClick("left", $pos[0] - 88, $pos[1] + 51, 2, 1) It works great If that work to you, then fine... i never use ControlClick that way.... This left me with a doubt about what Window he want to automate. Link to comment Share on other sites More sharing options...
Guest Posted September 2, 2011 Share Posted September 2, 2011 This left me with a doubt about what Window he want to automate.It also solved in another way 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