0

So I have this script (thanks is due to whoever):

lctrl::
 {
   toggle:=!toggle
 }

[color=red]~[/color]lbutton::
 {
   if toggle

When holding Ctrl, it prevents the scripts from working. How do I make it so that only one press of Ctrl is required to prevent the other scripts from working? Then when pressed again the scripts start working again.

1

This will let you press Ctrl once to toggle, and left-click will rapid-repeat whatever command you insert in Line 6.

lCtrl::toggle:=!toggle

~lButton::
    if toggle  ; Only run if toggle is on
        while, getKeyState("lButton")  ; Repeat if left-click is held
            ; Insert left-click function here
return

You can prevent other hotkeys from working by including the if toggle condition in their definitions:

$a::
    if toggle  ; Only run if toggle is on
        msgBox Toggle is on, you pressed A.
    else  ; Do nothing if toggle is off
        send a
return

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.