I
I
Ivan Wagner2019-07-11 19:06:41
autohotkey
Ivan Wagner, 2019-07-11 19:06:41

How to make AHK script activation and deactivation?

Hello! I have a question, there is a script for AutoHotKey:
LButton::
Loop
{
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
sleep, -1
If !getkeystate("LButton" )
Break
}
Return
it simulates pressing the W(sc11) key when the left mouse button is pressed.
I need the script to start working, for example, when the Insert (sc152) key is pressed, and stop working when the same key is pressed. Also, if possible, to make this script work in a specific application.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
a1987zz, 2019-07-11
@manavar_g

This will only work in notepad:
#If WinActive("ahk_exe notepad.exe")
suspend, on
LButton::
Loop
{
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11 }
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
Send, {sc11}
sleep, -1
If !GetKeystate("LButton")
Break
}
Return
#If
Insert::suspend

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question