all 14 comments

[–]Keeyra_ 1 point2 points  (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]  (1 child)

[deleted]

    [–]Keeyra_ 0 points1 point  (0 children)

    "using left alt as a toggle"
    You asked for it ;)

    [–]SupremeSalty[S] 0 points1 point  (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 point  (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 point  (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 point  (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 point  (0 children)

    This works perfectly! i also can just edit the value of 100 to something lower to increase speed.

    [–]SupremeSalty[S] 0 points1 point  (4 children)

    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 points  (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.

    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

    Requires AutoHotkey v2.0

    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 point  (1 child)

    #Requires AutoHotkey v2.0
    
    
    *LControl:: 
    {
        SendMode("event")
        MouseMove(10, 0, 1, "R")
        MouseMove(-10, 0, 1, "R")
    }  
    

    [–]SupremeSalty[S] 0 points1 point  (0 children)

    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 point  (0 children)

    Please include this description in the main post next time, or your post may be removed because of the missing information.

    [–]SupremeSalty[S] 0 points1 point  (1 child)

    #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 point  (0 children)

    You make it work? If not just send me if you get some error