How to stop this script working when a key has been clicked and activate again when clicked again

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jeffdavies_123
Posts: 8
Joined: 22 Apr 2023, 18:12

How to stop this script working when a key has been clicked and activate again when clicked again

22 Apr 2023, 18:17

Basically need to stop this script from working when a key is clicked and start working again when clicked again

Code: Select all

gosub generateNewRandom ;Generate initial random number

*~$LButton::
numClicks--
if(numClicks==0){
    Click
    gosub generateNewRandom ;Generate subsequent random numbers
}
return


generateNewRandom:
Random, numClicks , 1, 11 ;Adjust these values as needed
return 

[Mod action: Topic moved from "Ask for Help (v2)" since this is v1 code.]
ananthuthilakan
Posts: 188
Joined: 08 Jul 2019, 05:37
Contact:

Re: How to stop this script working when a key has been clicked and activate again when clicked again

22 Apr 2023, 23:19

this will do the trick

Code: Select all

gosub generateNewRandom ;Generate initial random number

t::  ; ---> the hotkey you want
toggle:=!toggle
return

*~$LButton::
if (toggle)
return
numClicks--
if(numClicks==0){
    Click
    gosub generateNewRandom ;Generate subsequent random numbers
}
return


generateNewRandom:
Random, numClicks , 1, 11 ;Adjust these values as needed
return 

ananthuthilakan
Posts: 188
Joined: 08 Jul 2019, 05:37
Contact:

Re: How to stop this script working when a key has been clicked and activate again when clicked again

22 Apr 2023, 23:33

this will also do the trick

Code: Select all

gosub generateNewRandom ;Generate initial random number

t::  ; ---> the hotkey you want
toggle:=!toggle
return

#if (toggle=1)

*~$LButton::
numClicks--
if(numClicks==0){
    Click
    gosub generateNewRandom ;Generate subsequent random numbers
}
return

#if

generateNewRandom:
Random, numClicks , 1, 11 ;Adjust these values as needed
return 



Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, Google [Bot] and 132 guests