AHK script freezing mouse Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Marcell1992

AHK script freezing mouse

30 May 2018, 05:05

Hi, I'm using the following script:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode 2
#MaxThreadsPerHotkey 3


^E::
Toggle := !Toggle
Loop
{
	SetControlDelay, -1
	If (!Toggle)
		Break
	ControlClick, x643 y520, Kongregate - Google Chrome,, Left, 1, NA,
	Sleep 35 ; Make this number higher for slower clicks, lower for faster.
}
Return

^D::
Toggle := !Toggle
Loop
{
	SetControlDelay, -1
	If (!Toggle)
		Break
Click
Sleep 50
}
Return
The problem is, after a random period of time, regardless if the script is actively running or not, the mouse would just freeze up completely. I would need to restart my pc for me to regain mouse functionality again.

Things I've noticed:
- Not sure if it's coincidental and there is something else wrong with my pc but this started happening since the first time I ran this script.
- It appears that the more I use the script, the more frequently I need to restart my PC due to the freeze.
- I tried to update my mouse drivers to see if it's a driver issue, but it appears my mouse has been unsupported since like 2011, lol.
- My keyboard works perfectly fine when my mouse freeze and when I move the mouse around while it's frozen, the sensor does show that the movement is being detected.
- I tried to not run the script to see if it actually is the script, but this script just made my life too easy to want to not use it xD
swagfag
Posts: 4005
Joined: 11 Jan 2017, 17:59

Re: AHK script freezing mouse

30 May 2018, 08:34

So did you or did you not conduct a test without running the script? What happens when you kill the script?
User avatar
donaldthejohn
Posts: 25
Joined: 27 Mar 2018, 20:23

Re: AHK script freezing mouse  Topic is solved

30 May 2018, 08:36

I think it's your mouse, i would test it but i dont want to spend another $50 if it is the script. if you have another old or crappy mouse lying around, id say try using that and test the script
Edit: didnt really think this through, its your mouse; its early in the morning forgive me
tl;dr: im tired and wrong
Last edited by donaldthejohn on 30 May 2018, 08:45, edited 1 time in total.
I am a noob at coding, PLEASE be patient with me :D
swagfag
Posts: 4005
Joined: 11 Jan 2017, 17:59

Re: AHK script freezing mouse

30 May 2018, 08:38

What are you taking about? This script can't break (read: damage) your mouse
User avatar
donaldthejohn
Posts: 25
Joined: 27 Mar 2018, 20:23

Re: AHK script freezing mouse

30 May 2018, 08:41

In theory, it can. The program is interacting with the position of the cursor, and has a chance to make the mouse more finicky then it already was.
I am a noob at coding, PLEASE be patient with me :D
swagfag
Posts: 4005
Joined: 11 Jan 2017, 17:59

Re: AHK script freezing mouse

30 May 2018, 08:46

I see you're going for the double down approach...
Just stop, there is nothing about the however many lines of code posted above that can cause damage to a mouse.

Either stop misleading people or prove me wrong, in practice preferably.
User avatar
donaldthejohn
Posts: 25
Joined: 27 Mar 2018, 20:23

Re: AHK script freezing mouse

30 May 2018, 08:48

Okay , you're telling me that if i use an ahk script to delete the drivers, the script didn't "break" the mouse
I am a noob at coding, PLEASE be patient with me :D
User avatar
donaldthejohn
Posts: 25
Joined: 27 Mar 2018, 20:23

Re: AHK script freezing mouse

30 May 2018, 08:50

And its not false information, the script could easily just have taken the drivers or whatnot that extra mile and it finally cut down.
I am a noob at coding, PLEASE be patient with me :D
swagfag
Posts: 4005
Joined: 11 Jan 2017, 17:59

Re: AHK script freezing mouse

30 May 2018, 09:13

No, I'm telling you(twice, in fact, I've mentioned this, already) that this script(read: the one that's posted in the OP) cannot cause any damage to a mouse whatsoever.
User avatar
donaldthejohn
Posts: 25
Joined: 27 Mar 2018, 20:23

Re: AHK script freezing mouse

30 May 2018, 09:18

Okay so that leaves me with two questions:
1: Then why didn't you just say "its your mouse" instead of "So did you or did you not conduct a test without running the script? What happens when you kill the script?"? which leads one to believe that the script could be the problem.
2: You're saying that by interacting with the mouse, it can't be damaged?
I'm not saying it will damage the mouse, im saying it can
I am a noob at coding, PLEASE be patient with me :D
swagfag
Posts: 4005
Joined: 11 Jan 2017, 17:59

Re: AHK script freezing mouse

30 May 2018, 09:36

why didn't you just say "its your mouse"
i didnt say it, cuz i dont know for a fact that "its your mouse"
instead of "So did you or did you not conduct a test without running the script? What happens when you kill the script?"? which leads one to believe that the script could be the problem.
it very well could be. that is not to say it can/will/may rek ur $50 mouse, as your posting might lead one to believe
2: You're saying that by interacting with the mouse, it can't be damaged?
I'm not saying it will damage the mouse, im saying it can
i told you already what im saying, but w/e ill repeat myself: im saying it cant
User avatar
donaldthejohn
Posts: 25
Joined: 27 Mar 2018, 20:23

Re: AHK script freezing mouse

30 May 2018, 09:41

1: The objective is to help others, so why didn't you be straight to the point?
2: That contradicts what you just said: How could the script be the problem when you know the mouse is the problem?
3: Let me get this straight, you're saying that by interacting with something it can't be harmed. Ex. I am petting my dog, no harm can be done. It's not possible that ANY(EVEN ACCIDENTAL) harm can be done to my dog by petting them.
I am a noob at coding, PLEASE be patient with me :D
Marcell
Posts: 46
Joined: 26 Jul 2016, 05:47

Re: AHK script freezing mouse

31 May 2018, 02:05

swagfag wrote:What are you taking about? This script can't break (read: damage) your mouse
I didn't say it damaged my mouse because when I restart my PC it works fine again. When my mouse freezes again I won't use the script and see if it is the script. Another thing I've notice, I can still use my hotkeys and the script would run, clicking either at the current location for the one hotkey or at the specified location for the other.
Marcell
Posts: 46
Joined: 26 Jul 2016, 05:47

Re: AHK script freezing mouse

05 Jun 2018, 02:40

I've ran without the script for 3 days now and no freezing, so it is the script that freeze my mouse. I think it's the specific window and specific position in window part of the script that bugs my mouse.
DeadHead1984
Posts: 4
Joined: 04 Jun 2018, 21:49

Re: AHK script freezing mouse

06 Jun 2018, 20:37

I am actuualy having the same issue but mine is for a game, the mouse freezes up after using my hotkey script for a couple minutes then I have to restart the game..
swagfag
Posts: 4005
Joined: 11 Jan 2017, 17:59

Re: AHK script freezing mouse

07 Jun 2018, 08:26

swagfag wrote:What happens when you kill the script?
also, dont redefine ControlKeyDelay every iteration of the loop, try this:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2
SetControlDelay, -1

^E::
Toggle := !Toggle
while(Toggle)
{
	ControlClick, x643 y520, Kongregate - Google Chrome,, Left, 1, NA,
	Sleep 35 ; Make this number higher for slower clicks, lower for faster.
}
Return

^D::
Toggle := !Toggle
while(Toggle)
{
	Click
	Sleep 50
}
Return

Return to “Ask For Help”

Who is online

Users browsing this forum: BarryGil, boiler and 38 guests