Dr_TDM Posted June 23, 2016 Share Posted June 23, 2016 Hello I have a small code, and i want to freeze the mouse movement, I need a very simple solution,, I've tried Mouse Trap,, but didn't success, i'm new to this.. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 23, 2016 Moderators Share Posted June 23, 2016 @Dr_TDM welcome to the forum. As you are new, you may have missed the fact that we can't help much without being able to see your "small code". Otherwise, you're asking us to first guess at what you're trying to accomplish and then troubleshoot for you. Please help us help you by posting your code "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...
water Posted June 23, 2016 Share Posted June 23, 2016 Does the _Mousetrap example script work for you? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Dr_TDM Posted June 23, 2016 Author Share Posted June 23, 2016 thanks JLogan3o13 for the reply,, i have no problem posting the code,, but i remember i once read in one of the threads, that the member should not say why the script is for or post it,, otherwise it will be deleted,, anyways.. i need the mouse to be clicking every one minute,, but in te same spot that i leave the mouse when i start the function,,, i have managed to make a step foward with help from trojan55 but either the (mouseclick) works or the (mousemove),,, but couldn't do both... so here is the code Global $Paused HotKeySet("{PGDN}","_Start") HotKeySet ("{PGUP}", "TogglePause") HotKeySet ("{Delete}", "_Freeze") Func _Freeze() $pos = MouseGetPos() While 1 MouseMove($pos[0],$pos[1]) WEnd EndFunc Func _Start() For $a = 1 to 1000 step 1 MouseClick ("Left") Sleep (60000) Next EndFunc While 1 Sleep(10000) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Link to comment Share on other sites More sharing options...
Dr_TDM Posted June 23, 2016 Author Share Posted June 23, 2016 also i've tried combining the two functions to start with one hotkey but it is the same,,, only one function starts Func _Freeze() $pos = MouseGetPos() While 1 MouseMove($pos[0],$pos[1]) WEnd For $a = 1 to 1000 step 1 MouseClick ("Left") Sleep (3000) Next EndFunc Link to comment Share on other sites More sharing options...
water Posted June 23, 2016 Share Posted June 23, 2016 4 minutes ago, Dr_TDM said: but i remember i once read in one of the threads, that the member should not say why the script is for or post it,, otherwise it will be deleted If this means we are talking about game autoamtion here then you can be sure that not only your code will be removed but the thread will be blocked as well. So it would greatly help if you could tell us which program you try to automate My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Dr_TDM Posted June 23, 2016 Author Share Posted June 23, 2016 water thank you,,, but the idea of the Mousetrap is good,, but i couldn't do it,,, i don't know what is the #include for, Link to comment Share on other sites More sharing options...
water Posted June 23, 2016 Share Posted June 23, 2016 Dog ate your help file? The explanation what the statement is for is just a click away My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 23, 2016 Moderators Share Posted June 23, 2016 @Dr_TDM I agree with water, since you opened the door please explain exactly what you're trying to accomplish with Quote i need the mouse to be clicking every one minute,, but in te same spot that i leave the mouse when i start the function,,, "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...
Dr_TDM Posted June 23, 2016 Author Share Posted June 23, 2016 @JLogan3o13 @water It's not a game issue,, i have a problem with windows,, it keeps removing the selection from my current window, so it becomes inactive and then the keyboard strokes don't do anything... I need the code to keep clicking the mouse so the window that i'm working on keeps active,, most of my work is on excel and i mostly use the keyboard. I tried to fix it but could't,, and the service guy adviced to install a new windows,, but i cannot because i have a lot of programes that will take days to re-install and configure.. So this code is a simple solution for me... Link to comment Share on other sites More sharing options...
water Posted June 23, 2016 Share Posted June 23, 2016 When working with Excel you shouldn't automate the GUI but use the Excel UDF that comes with AutoIt. So your scripts will become much more reliable. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mrider Posted June 23, 2016 Share Posted June 23, 2016 Suggestion: Instead of trying to make it so the mouse can't move, instead have the program start with a snapshot of the mouse's current location when the program starts, and then always click there even if the mouse has moved. Local $sleep = 60*1000 ; 1 minute, adjust as necessary Local $orig_pos = MouseGetPos() While True Sleep($sleep) Local $new_pos = MouseGetPos() MouseClick("Left", $orig_pos[0], $orig_pos[1], 1, 0) MouseMove($new_pos[0], $new_pos[1], 0) ConsoleWrite("Clicked" & @LF) WEnd How's my riding? Dial 1-800-Wait-There Trying to use a computer with McAfee installed is like trying to read a book at a rock concert. Link to comment Share on other sites More sharing options...
junkew Posted June 24, 2016 Share Posted June 24, 2016 this looks more logical to use https://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm with weird behavior in windows I first would be concerned about a virus. Finding the rootcause of your problem looks much better than a bypass with a script. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Dr_TDM Posted June 27, 2016 Author Share Posted June 27, 2016 @water @mrider @junkew thanks you all for replying,, @water i work with excel manually and i don't need to automate it,,, @junkew the winactivate is the best solution,, thanks for the suggestion.. 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