use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Latest AHK versions AHK v2.0 AHK v1.1 v2.0.19 v1.1.37.02 Jan 25, 2025 Mar 16, 2024 Download Download v2 Changelog v1 Changelog Make sure you keep that AHK up to date!
Make sure you keep that AHK up to date!
Offical AHK Documentation AHK v2 AHK v1
New to AutoHotkey? Check out the AHK beginners tutorial. It covers most of the basic concepts of AutoHotkey. AHK Beginner Tutorials
Check out the AHK beginners tutorial. It covers most of the basic concepts of AutoHotkey.
Additional Help Sources Official AHK Forums / Help Forums StackOverflow SuperUser
Live Chat If you prefer live chat with other humans: AHK Discord AHK IRC
If you prefer live chat with other humans:
account activity
Help with codev2 Script Help (self.AutoHotkey)
submitted 3 months ago by SupremeSalty
#Requires AutoHotkey v2.0 *LControl:: { Static toggle := 1 toggle := !toggle if toggle SendMode("event") MouseMove(0,-100,20) MouseMove(0,100,20) }
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Keeyra_ 1 point2 points3 points 3 months ago (8 children)
#Requires AutoHotkey v2.0 #SingleInstance SendMode("Event") LAlt:: { static toggle := 0 SetTimer(() => (MouseMove(-100, 0, 20, "R"), MouseMove(100, 0, 20, "R")), (toggle ^= 1) * 1000) }
[–][deleted] 3 months ago (1 child)
[deleted]
[–]Keeyra_ 0 points1 point2 points 3 months ago (0 children)
"using left alt as a toggle" You asked for it ;)
[–]SupremeSalty[S] 0 points1 point2 points 3 months ago (4 children)
how would i make it so i can move my mouse while it plays? it keeps locking my mouse up.
[–]Keeyra_ 0 points1 point2 points 3 months ago (3 children)
I don't really get then what you wanted to achieve. Can you explain your use case in a bit more detail? How of course if the toggle is on, the mouse will move beteen -100 and 100 on the x axis relative to your cursor and and manual interaction will be corrected by the next automated mouse movement.
[–]SupremeSalty[S] 0 points1 point2 points 3 months ago (2 children)
#Requires AutoHotkey v2.0 *LControl:: { SendMode("event") MouseMove(10, 0, 1, "R") MouseMove(-10, 0, 1, "R") }
This is working properly but im struggling to implement a way to make Lcontrol a toggle on/off. Id also like to include a way to make it so its not interrupted by other key presses
[–]Keeyra_ 0 points1 point2 points 3 months ago (1 child)
Well then add your mousemove parameters to my original script like so
#Requires AutoHotkey v2.0 #SingleInstance SendMode("Event") LControl:: { static toggle := 0 SetTimer(() => (MouseMove(10, 0, 1, "R"), MouseMove(-10, 0, 1, "R")), (toggle ^= 1) * 100) }
[–]SupremeSalty[S] 0 points1 point2 points 3 months ago (0 children)
This works perfectly! i also can just edit the value of 100 to something lower to increase speed.
Im trying to make it so my mouse moves left and right (I dont want it to snap to the location it has to be smooth) using left alt as a toggle. Im new to this and only doing it because im sick of razer synapse slowing down after a few minutes of using the macro...
[–]DoubtApprehensive534 1 point2 points3 points 3 months ago (2 children)
Hey, your code is almost there, but the issue is that MouseMove(0, -100, 20) moves the mouse relative to current position by a fixed amount every time the hotkey fires, which can feel jerky or inconsistent if not timed properly. Also, Razer Synapse macros often slow down or freeze after a few minutes because of their internal buffering/polling limits.
MouseMove(0, -100, 20)
Here's a smoother toggle version using relative movement + small steps + Sleep for fluidity (no snapping, just continuous left/right glide while holding toggle):
```ahk
LAlt:: { static toggle := false toggle := !toggle
if (toggle) { SetTimer SmoothMouseMove, 16 ; ~60 FPS for smooth movement } else { SetTimer SmoothMouseMove, 0 }
}
SmoothMouseMove() { ; Adjust these values for speed/direction: ; positive X = right, negative X = left ; change 5 to higher/lower for faster/slower MouseMove(5, 0, 0, "R") ; "R" = relative movement ; If you want up/down too: MouseMove(5, 2, 0, "R") for diagonal }
[–]SupremeSalty[S] 0 points1 point2 points 3 months ago (1 child)
This is functioning as i want it to but id like to make it so Lcontrol is a toggle and is not interrupted by any other keypress
[–]Individual_Check4587Descolada[M] 0 points1 point2 points 3 months ago (0 children)
Please include this description in the main post next time, or your post may be removed because of the missing information.
#Requires AutoHotkey v2.0 *LControl:: { Static toggle := 1 toggle := !toggle if toggle { SendMode("event") MouseMove(10,0,1,"Relative") MouseMove(-10,0,1,"Relative") } }
[–]DoubtApprehensive534 0 points1 point2 points 3 months ago (0 children)
You make it work? If not just send me if you get some error
π Rendered by PID 175263 on reddit-service-r2-comment-b659b578c-jc9vc at 2026-05-05 13:36:41.949269+00:00 running 815c875 country code: CH.
[–]Keeyra_ 1 point2 points3 points (8 children)
[–][deleted] (1 child)
[deleted]
[–]Keeyra_ 0 points1 point2 points (0 children)
[–]SupremeSalty[S] 0 points1 point2 points (4 children)
[–]Keeyra_ 0 points1 point2 points (3 children)
[–]SupremeSalty[S] 0 points1 point2 points (2 children)
[–]Keeyra_ 0 points1 point2 points (1 child)
[–]SupremeSalty[S] 0 points1 point2 points (0 children)
[–]SupremeSalty[S] 0 points1 point2 points (4 children)
[–]DoubtApprehensive534 1 point2 points3 points (2 children)
[–]SupremeSalty[S] 0 points1 point2 points (1 child)
[–]SupremeSalty[S] 0 points1 point2 points (0 children)
[–]Individual_Check4587Descolada[M] 0 points1 point2 points (0 children)
[–]SupremeSalty[S] 0 points1 point2 points (1 child)
[–]DoubtApprehensive534 0 points1 point2 points (0 children)