DeathRow Posted March 31, 2012 Posted March 31, 2012 Hello Autoit forum, Does anybody knows how to simulate mouse clicks without moving the cursor ? Can be accomplished via API somehow ?
Guest Posted March 31, 2012 Posted March 31, 2012 Could you explain more. In the meantime There is MouseClick("Left") That will click.
DeathRow Posted March 31, 2012 Author Posted March 31, 2012 (edited) On 3/31/2012 at 1:14 PM, 'Scriptmaster said: Could you explain more. In the meantime There is MouseClick("Left") That will click. LOL What can I explain better than that ? So, I know the Mouseclick command, but I just want to simulate the click, without moving the cursor Example: Now my cursor( the mouse cursor ) is on the screen at x=200,y=200 coordinates. I want to simulate a click on a point at x=128, y=310 coordinates, but my cursor to remain at the 200, 200 position. How can I do that ? Any API function ? Edited March 31, 2012 by DeathRow
Guest Posted March 31, 2012 Posted March 31, 2012 (edited) Oh I see now! Not quite sure how, The cursor can only click where it is. If you could click without moving the cursor it would open up a whole new window for malicious software! I.E. not good! Edited March 31, 2012 by Guest
DeathRow Posted March 31, 2012 Author Posted March 31, 2012 (edited) On 3/31/2012 at 1:36 PM, 'Scriptmaster said: Oh I see now! Not quite sure how, The cursor can only click where it is. If you could click without moving the cursor it would open up a whole new window for malicious software! I.E. not good! no, I don't want it for malicus software I just want to use the function for my backup script cause I run it while I navigate and I can't do it in other way :/ EDIT: Ok I managed it : Sleep(3000) $pos=MouseGetPos() MouseClick("left",200,200,1,0) MouseMove($pos[0],$pos[1],0) Edited March 31, 2012 by DeathRow
Guest Posted March 31, 2012 Posted March 31, 2012 On 3/31/2012 at 2:05 PM, 'DeathRow said: no, I don't want it for malicus softwareI just want to use the function for my backup script cause I run it while I navigate and I can't do it in other way :/I did not mean you would i just meant that is the func exists it could be used for malicious purposes.
Rogue5099 Posted March 31, 2012 Posted March 31, 2012 (edited) Check out ControlClick, this does not move the mouse at all.$pos=MouseGetPos() MouseClick("left",200,200,1,0) MouseMove($pos[0],$pos[1],0)Not only does what you wrote don't do what you want but it does it twice. Moves to location then back.Edit: Grammer Edited March 31, 2012 by rogue5099 My projects: Inventory / Mp3 Inventory, Computer Stats
Bowmore Posted March 31, 2012 Posted March 31, 2012 (edited) Use Control click This example will click the back button in IE without moving the mouse cursor opt("MouseCoordMode",2) ControlClick("[CLASS:IEFrame]","","[CLASS:ToolbarWindow32; INSTANCE:1]","left",1,16,16) I use this method a lot for clicking specific buttons on toolbars where I can not get an ID for the individual buttons. Edited March 31, 2012 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
Hell4Ge Posted March 31, 2012 Posted March 31, 2012 http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950%28v=vs.85%29.aspx You ve to send WM_LBUTTON message http://msdn.microsoft.com/en-us/library/windows/desktop/ms645608%28v=vs.85%29.aspx I am sure, that it will be hard for you, if you didnt code in C lang before
DeathRow Posted April 1, 2012 Author Posted April 1, 2012 On 3/31/2012 at 6:21 PM, 'Bowmore said: Use Control click This example will click the back button in IE without moving the mouse cursor opt("MouseCoordMode",2) ControlClick("[CLASS:IEFrame]","","[CLASS:ToolbarWindow32; INSTANCE:1]","left",1,16,16) I use this method a lot for clicking specific buttons on toolbars where I can not get an ID for the individual buttons. But ControlClick command works only for control objects, if I want to click on a specific point or on a picture,it won't work On 3/31/2012 at 7:50 PM, 'Hell4Ge said: http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950%28v=vs.85%29.aspx You ve to send WM_LBUTTON message http://msdn.microsoft.com/en-us/library/windows/desktop/ms645608%28v=vs.85%29.aspx I am sure, that it will be hard for you, if you didnt code in C lang before YES This would be perfect! I am learning C++ but I'm still at pointers so I don't understand too good the APIs yet. I would really appreciate if someone could show me how to declare this API in a AU3 code Thankyou!
Bowmore Posted April 1, 2012 Posted April 1, 2012 On 4/1/2012 at 4:18 PM, 'DeathRow said: But ControlClick command works only for control objects, if I want to click on a specific point or on a picture,it won't work Just about everything you can see on a PC screen is a control or window including pictures, and controlClick will work with almost all of them if you give it the correct information The code below will click at coords 247,344 in an IE browser window if you change the first parameter to match whatever window your picture is in and change the coords at the end to the correct client mode coordinates I'm sure it will work for you. Give it a try you might supprise yourself. opt("MouseCoordMode",2) ControlClick("[CLASS:IEFrame]","","","left",1,247,344) "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
Demete Posted April 18, 2014 Posted April 18, 2014 On 4/1/2012 at 8:57 PM, Bowmore said: Just about everything you can see on a PC screen is a control or window including pictures, and controlClick will work with almost all of them if you give it the correct information The code below will click at coords 247,344 in an IE browser window if you change the first parameter to match whatever window your picture is in and change the coords at the end to the correct client mode coordinates I'm sure it will work for you. Give it a try you might supprise yourself. opt("MouseCoordMode",2) ControlClick("[CLASS:IEFrame]","","","left",1,247,344) Can you make this work for notepad to click on the File (x 20 y 40)? Because I cant :/
TrickyDeath Posted May 9, 2014 Posted May 9, 2014 to Demete - With ControlClick do not work for me eighter, but with normal mouseclick work fine. HotKeySet("{F5}", "RunIt") While 1 Sleep(100) WEnd Func RunIt() Opt("MouseCoordMode", 0) ;ControlClick("[CLASS:Notepad]", "", "", "left", 1, 26, 46) MouseClick("left",26,46,1, 1) Exit EndFunc ;==>RunIt Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)
FranksDesigNatures Posted April 15, 2016 Posted April 15, 2016 Hello there guys i know this blog is pretty old but maybe some of you are still around, im looking to simulate a click as well and while i see alot of great code im not sure to what language this code belongs to so im a bit lost, i was looking to do this using C++ or C# or even Java via the Processing IDE. im looking to simulate a left mouse click in a specific window in my pc BUT the key is that i will be using voice to simulate that click, for example i will say "meet" and meet is a String and when this String is heard i want this program im using to do a serial.write(i +"meet"); OR port.write(i +"meet"); and when this string is detected i want that simulation to happen. the reason is because i have this sketch in processing that requires you to click in order for something to happen and i cant just click because the pc itself will be out of reach, so i thought if i can use Visual Studios to use the speech recognition library and i can use the serial port why cant i use VS2013 to speak to it and have that send a string to processing so that it can simulate that click for me ?
Moderators Melba23 Posted April 15, 2016 Moderators Posted April 15, 2016 FranksDesigNatures, Quote im not sure to what language this code belongs to Expand The code in this thread (and in the majority of the forum) is AutoIt - a windows scripting language - and this forum is dedicated to helping people use it. Your explanation of what you wish to do makes me believe that AutoIt would not of itself be suitable (there is no speech recognition ability as far as I am aware) but you might be able to use the AutoItX DLL within your C++/C#/Java code. Perhaps a few more details on what exactly you are attempting to do would be useful to those more experienced in using the DLL than myself. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
FranksDesigNatures Posted April 15, 2016 Posted April 15, 2016 well thanks for that explanation but i never heard of Autoit hmmm what ide do you guys use and is only for pc use right ? is not for micro controllers right ? now as for you question yes, i hear you that there is no speech but if your read my post correctly i mention that i already have a written program that uses this features of verbal communication and i can even make shell commands like open/close IE,Paint,calc,pretty much just about any program installed in my pc SO if i can have Autoit simulate a mouseclick as a given location by just a press of a button then if my theory is correct then i should be able to tell me program to initiate that key press that autoit would assume to be mouseclick and if so then tadaaaa! we have achieve what i was looking for ? "dammm hows that for a pseudo?"
Moderators Melba23 Posted April 15, 2016 Moderators Posted April 15, 2016 FranksDesigNatures, Quote but i never heard of AutoIt Expand And yet you posted in a thread of the AutoIt forum...... Quote what ide do you guys use and is only for pc use right Expand Most of us use the modified SciTE editor packaged with AutoIt (or its big brother SciTE4AutoIt3) but that is not an IDE as generally understood. There a couple of IDEs available - ISN AutoIt Studio is probably the most developed. And yes, AutoIt is for Windows only as it uses the Windows APIs to do most of the work (although it does partly work on Linux with WINE). Quote i should be able to tell me program to initiate that key press that autoit would assume to be mouseclick Expand I thought the idea was to get AutoIt to simulate a mouseclick? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
FranksDesigNatures Posted April 15, 2016 Posted April 15, 2016 Quote I thought the idea was to get AutoIt to simulate a mouseclick? Expand yes but as i been reading autoit does not just randomly do mouseclick does it now? you need todo something for that simulation to occur,
Moderators Melba23 Posted April 15, 2016 Moderators Posted April 15, 2016 FranksDesigNatures, Let us try and make some sense out of this request. If I have understood correctly, you have a PC which is "out of reach" for some reason and you want to click in a running app when you speak a certain word. So a few questions: Why is the PC "out of reach"? What is the app that needs to be clicked? How does your existing "speech recognition" program make the shell commands you mentioned - i.e. how will it communicate with an AutoIt executable? Once we get a better handle on what you are trying to do we can start making sensible suggestions as to how you might achieve your aims. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
FranksDesigNatures Posted April 15, 2016 Posted April 15, 2016 your questions seems a bit out of subject, i dont see how this would help you identify my main question. Quote Why is the PC "out of reach"? Expand im not sure why this matters so perhaps you might want to clear this up. Quote What is the app that needs to be clicked? Expand again im not sure why ask, from what i gather this is very little of importance and which is why i like to know how to go about using this script, because as i understand autoit does not care about the program but about the x&y coordinates of your pc screen. Quote How does your existing "speech recognition" program make the shell commands you mentioned - i.e. how will it communicate with an AutoIt executable? Expand lol again though i will admit that for you to ask this specific question that tells me that you do not know C++/C# as if you did you would know how im doing this, so that being said all i can tell you is that i program my pc todo such feats using vs2013, Quote how will it communicate with an AutoIt executable? Expand well like i said autoit does not care about other programs it just cares about "that" specific key you will press to simulate that mouse click on this part of the screen 'x&y' same goes for my program, it does not interacts with any program but itself all that it cares is that my voice is heard and soon after it will meet a conditional statement saying that IF user said 'click' then it will respond by simulating that key press that autoit is expecting for that mouse click to happen where i have predefined before.
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