King Posted January 28, 2018 Share Posted January 28, 2018 Hey. For some reason I can't get this to work and it should be pretty simple. But I am new to this still. What I want is a script that when I press F1 it turns on and off. When it turns on every 5 seconds it presses the left mouse button. All help would be greatly appreciated. Link to comment Share on other sites More sharing options...
King Posted January 28, 2018 Author Share Posted January 28, 2018 (edited) HotKeySet("^!z","Movment");^!z is Ctrl+Alt+'z' to run the Movment HotKeySet("^!x","End");^!x is Ctrl+Alt+'x' to close the Movment While 1 Sleep(5000) WEnd Func Movment() MouseClick ("Left") sleep(5000) WEnd EndFunc Func End() Exit EndFunc I know this uses Ctrl+alt+z and X to start and stop. Which would be fine. It just doesn't repeat. And this may be way way off. Like I said I am trying to learn lol. Edited January 28, 2018 by King Link to comment Share on other sites More sharing options...
King Posted January 28, 2018 Author Share Posted January 28, 2018 (edited) HotKeySet("^!z","Movment");^!z is Ctrl+Alt+'z' to run the Movment HotKeySet("^!x","End");^!x is Ctrl+Alt+'x' to close the Movment While(1) MouseClick('left', $coord[0], $coord[1] - 0, 1, 0) Sleep(5000) WEnd Just trying a different script while I wait on reply's Edited January 28, 2018 by King Doesn't work Link to comment Share on other sites More sharing options...
King Posted January 28, 2018 Author Share Posted January 28, 2018 Nothing makes my anxiety spike like that stupid "Ding" that tells you something is wrong! lol Link to comment Share on other sites More sharing options...
HankHell Posted January 28, 2018 Share Posted January 28, 2018 (edited) #include <Misc.au3> Global $State = 0 Global $MOUSE_CLICK_LEFT Global $x = 0 Global $y = 0 While 1 If _IsPressed("21") Then $State = 1 ; Page Up If _IsPressed("22") Then $State = 0 ; Page Down If _IsPressed("24") Then ExitLoop ; Home If $State = 1 Then MouseMove ( $x , $y ) MouseClick($MOUSE_CLICK_LEFT) EndIf WEnd it's not a complete script but you get the idea Edited January 28, 2018 by HankHell Link to comment Share on other sites More sharing options...
King Posted January 28, 2018 Author Share Posted January 28, 2018 4 minutes ago, HankHell said: #include <Misc.au3> Global $State = 0 Global $MOUSE_CLICK_LEFT Global $x = 0 Global $y = 0 While 1 If _IsPressed("21") Then $State = 1 ; Page Up If _IsPressed("22") Then $State = 0 ; Page Down If _IsPressed("24") Then ExitLoop ; Home If $State = 1 Then MouseMove ( $x , $y ) MouseClick($MOUSE_CLICK_LEFT) EndIf WEnd it's not a complete script but you get the idea At this point I would be happy with a script that when I open it, it just starts pressing the left mouse button every 5 seconds. I have this which works fine other than it moves my mouse. I just want it to press the left mouse button wherever my mouse is. While 1 Sleep(60000) MouseClick('Left', 100, 100, 2, 1) WEnd How would I change the above to stop moving the mouse? thanks. Link to comment Share on other sites More sharing options...
HankHell Posted January 28, 2018 Share Posted January 28, 2018 you can set the $State before WEnd to give it a different part of the program to cycle through after it completes the first task Link to comment Share on other sites More sharing options...
HankHell Posted January 28, 2018 Share Posted January 28, 2018 Post your current script in its entirety real quick, I'll help you out Link to comment Share on other sites More sharing options...
King Posted January 28, 2018 Author Share Posted January 28, 2018 That is my entire script. This works perfectly accept it moves my mouse instead of left click where the mouse is. If I could just get this to press the left mouse button where the mouse is instead of moving... That's all I need. While 1 Sleep(5000) MouseClick('Left', 100, 100, 2, 1) WEnd I believe the 100,100 needs to be changed to something else. I just don't know what. Link to comment Share on other sites More sharing options...
HankHell Posted January 28, 2018 Share Posted January 28, 2018 (edited) #include <Misc.au3> Global $State = 0 Global $MOUSE_CLICK_LEFT Clicky() Func Clicky() While 1 If _IsPressed("70") Then $State = 1 ; F1 While $State = 1 MouseClick($MOUSE_CLICK_LEFT) Sleep(5000) If _IsPressed("1b") Then $State = 0 ; ESC WEnd WEnd Endfunc is that what you're trying to do? the script starts paused press f1 to start the script, and hold ESC for 5 seconds to pause it again Edited January 28, 2018 by HankHell Link to comment Share on other sites More sharing options...
HankHell Posted January 28, 2018 Share Posted January 28, 2018 (edited) oops doublepost <code edited> Edited January 28, 2018 by HankHell Link to comment Share on other sites More sharing options...
Moonscarlet Posted January 28, 2018 Share Posted January 28, 2018 53 minutes ago, King said: That is my entire script. This works perfectly accept it moves my mouse instead of left click where the mouse is. If I could just get this to press the left mouse button where the mouse is instead of moving... That's all I need. While 1 Sleep(5000) MouseClick('Left', 100, 100, 2, 1) WEnd I believe the 100,100 needs to be changed to something else. I just don't know what. Hey, Use "default" for the current x,y positions. MouseClick("left",Default,Default,2,0) from https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm Quote Parameters: x, y [optional] The x/y coordinates to move the mouse to. If no x and y coords are given, the current position is used (default). Link to comment Share on other sites More sharing options...
HankHell Posted January 28, 2018 Share Posted January 28, 2018 oh you want to doubleclick? my bad...this also works #include <Misc.au3> Global $State = 0 Global $MOUSE_CLICK_LEFT Clicky() Func Clicky() While 1 If _IsPressed("70") Then $State = 1 ; F1 While $State = 1 MouseClick($MOUSE_CLICK_LEFT) MouseClick($MOUSE_CLICK_LEFT) Sleep(5000) If _IsPressed("1b") Then $State = 0 ; ESC WEnd WEnd Endfunc Moonscarlet 1 Link to comment Share on other sites More sharing options...
water Posted January 28, 2018 Share Posted January 28, 2018 Can you please tell us which program you try to automate? Working with screen coordinates istn't very reliable as i depends on window position, screen resolution etc. Most of the time there are more reliable ways to do what you want to do. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
juxwillx Posted April 28, 2022 Share Posted April 28, 2022 I’m working on a similar script but am confused how to make the mouse click with a fixed interval and also with varying intervals. I’m using this tool for auto clicking and want to replicate some of its functionalities. Link to comment Share on other sites More sharing options...
Nine Posted April 28, 2022 Share Posted April 28, 2022 @juxwillx As previously mentioned by Water, mouse clicks is very unreliable and frequently used for game automation, which is against forum rules. In order for us to reply to such request, it would be a good idea to dispel doubts by supplying the application name and a print screen of the running application so we can see what you are trying to achieve. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 1, 2022 Moderators Share Posted May 1, 2022 On 4/27/2022 at 8:11 PM, juxwillx said: I’m working on a similar script but am confused how to make the mouse click with a fixed interval and also with varying intervals. I’m using this tool for auto clicking and want to replicate some of its functionalities. Which functionalities (what are you trying to click on), and in which application (as has been asked twice)? Please help us out with a detailed description, crystal ball is in the shop "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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