Page 2 of 2

Re: Autofire and toggle

Posted: 09 May 2016, 18:25
by Geff T
tidbit wrote:Welcome to ahk, Geff T :)
ty

i have had to give in and ask a Q here https://autohotkey.com/boards/viewtopic ... 827#p85827but i wont go to OT

Re: Autofire and toggle

Posted: 30 Jun 2016, 05:30
by evilC
Please can we remove the GetKeyState technique for detecting release of a key? IMHO it is bad advice (Only works with one key) and is inefficient (Potentially introduces up to 10ms lag if you use a Sleep 10)

See here: https://autohotkey.com/boards/viewtopic.php?f=7&t=19745

Re: Autofire and toggle

Posted: 05 Mar 2017, 15:01
by wuuii
ok but how do i change the hotkey

Re: Autofire and toggle

Posted: 05 Mar 2017, 16:22
by tidbit
please read before asking.
Helpful links:
1. Don't know how to use these? READ THIS: https://autohotkey.com/docs/Tutorial.htm
2. AHK not working in your game/program? READ THIS: https://autohotkey.com/boards/viewtopic.php?f=7&t=11084
3. List of keys to use as HOTKEYS (the line with "::"): https://autohotkey.com/docs/KeyList.htm
...
and also a link explaining.
as well as a tutorial teaching you the very basics.

Re: Autofire and toggle

Posted: 27 Jan 2018, 19:01
by landfillbaby

Code: Select all

*Space::
Send {Space}
Sleep 250
Return
works for me (holding space presses it exactly 4 times per second), no need for a loop, i guess my keyboard works weird?

Re: Autofire and toggle

Posted: 27 Jan 2018, 19:07
by GreatGazoo
landfillbaby wrote:

Code: Select all

*Space::
Send {Space}
Sleep 250
Return
works for me (holding space presses it exactly 4 times per second), no need for a loop, i guess my keyboard works weird?

could it be that the hotkey and the key sent being the same key, that it's creating a loop on it's own

Re: Autofire and toggle

Posted: 28 Jan 2018, 02:06
by landfillbaby
GreatGazoo wrote:could it be that the hotkey and the key sent being the same key, that it's creating a loop on it's own
ok, i've just checked, it still works when the input isn't in the output

Code: Select all

Space::
Send hello
Sleep 250
Return
this would probably be a bad thing if i wasn't trying to make a loop anyway

Re: Autofire and toggle

Posted: 28 Jan 2018, 02:50
by GreatGazoo
landfillbaby wrote:
GreatGazoo wrote:could it be that the hotkey and the key sent being the same key, that it's creating a loop on it's own
ok, i've just checked, it still works when the input isn't in the output

Code: Select all

Space::
Send hello
Sleep 250
Return
this would probably be a bad thing if i wasn't trying to make a loop anyway


yeah i noticed that too with my random number generator, while holding control j it sends random number, enter, and it sends J's too

Code: Select all


^j::
    SoundBeep, 525, 100 
    Random, rand, 1, 10000
    send, %rand% {enter}
	return
	

Re: Autofire and toggle

Posted: 28 Jan 2018, 04:21
by landfillbaby
it turns out it's tied to the physical keyboard's auto-repeat feature, and is interrupted by other keypresses
i used this instead:

Code: Select all

SetKeyDelay -1
t=
Space Up::t=
Space::
t=1
While t {
Send % " "
Sleep 250
}
Return
it's basically just the toggle method but without the threading problem

Re: Autofire and toggle

Posted: 30 Jan 2018, 13:45
by Delta Pythagorean
landfillbaby wrote:it turns out it's tied to the physical keyboard's auto-repeat feature, and is interrupted by other keypresses
i used this instead:

Code: Select all

SetKeyDelay -1
t=
Space Up::t=
Space::
t=1
While t {
	Send, % " "
	Sleep, 250
}
Return
it's basically just the toggle method but without the threading problem
If you want to use a spammer for a key, just use this. It's small, simple, and can be used anywhere in a script, not just a hotkey.

Re: Autofire and toggle

Posted: 25 May 2019, 15:05
by biti
hi guys i need a little script! very easy, activate/deactivate with F4, when i hold primary mousbutton pressed the mouse moves down with same speed without stop, and when i reallease the primarymousebutton it stops. can sombody help me pls?

Re: Autofire and toggle

Posted: 17 Jul 2020, 19:45
by rfxcasey
I know this thread is super old but as it's about a tool it seems like to place to request support for said tool. Have a weird problem, while running the test from this tool in game, the key inputs are indeed making it in game through several commands like Send, SendInput, SendEvnt and what have you. So I have a script that sends the same command that works in the test tool but it's not working in game. Autohotkey is set to run as Admin, I'm on the latest version, I've even tried compiling the script into a .exe file but it doesn't work in game. The script in question DOES work in a text window, toggle the key repeat on and on with the push of a button and that does indeed work in notepad. So what can the problem be, is it a problem with the window the script is focusing on? I've got the game in windowed mode, everything running as admin and just won't work. As said, keystrokes are making their way into the game via the test tool just not with my script.

Re: Autofire and toggle

Posted: 06 Aug 2020, 02:43
by LeafyKeaf
would there be a way to make it so it would click faster

Re: Autofire and toggle

Posted: 24 Sep 2020, 07:48
by ahk1
Hello,
If you're interested, I created a script for: Autofire toggle using the Keyboard or a Game Controller
You can use the analog thumbstick or controller keys to toggle the autofire of a key, too.
The script's post is called: Autofire toggle using Keyboard or Game Controller (can be used for Game Emulators Speed Toggle) and has the address:
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=81380