Page 1 of 1

i need help code

Posted: 01 Oct 2022, 05:36
by juanll2002
need help stay pressed key A and hold down for 10 seconds,stop later press the left arrow key for 1 second and repeat the same until deactivation tranks for help


Consider the following

Code: Select all

#UseHook On

x::
KeyWait x
n := TRUE
While (n)
{
    Send {a down}
    Sleep 10000
    Send {a up}
    Send {right down}
    sleep 2000	
    Send {right up}
    
}
Return

3:: n := FALSE
[Mod edit: [code][/code] tags added.]

Re: i need help code

Posted: 01 Oct 2022, 06:14
by mikeyww

Code: Select all

OnExit("done")

#MaxThreadsPerHotkey 2
F3::
on := !on
SoundBeep, 1000 + 500 * on
While on {
 Send {a down}
 Loop, 20
  Sleep, 500 * on
 Send % "{a up}" (on ? "{Left down}" : "")
 Loop, 2
  Sleep, 500 * on
 Send {Left up}
}
Return

done(exitReason, exitCode) {
 Send {a up}{Left up}
 SoundBeep, 1900
}

Re: i need help code

Posted: 01 Oct 2022, 14:38
by juanll2002
@mikeyww

friend without beep sound and activate with one key and deactivate with other as well as shipping Thank you

Code: Select all

#UseHook On

x::
KeyWait x
n := TRUE
While (n)
{
    Send a
    Sleep 50
}
Return

3:: n := FALSE

Re: i need help code

Posted: 01 Oct 2022, 14:55
by mikeyww
Hello,

You can use any hotkey to set the toggle variable (e.g., on) to False. An example is found in your script. You can remove the SoundBeep command if you wish. Enjoy!

In terms of shipping, if you post your mailing address, I will print the script and ship it to you.