I want the function to start and stop when i click F3 the keys that i want to be press are 1,2,3,4,5 not from the numpad but from the numbers that contains the symbols.
1
delay 3 milliseconds
2
delay 3 milliseconds
3
delay 3 milliseconds
4
delay 3 milliseconds
5
delay 3 milliseconds
When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
-
- Posts: 12
- Joined: 07 Jan 2018, 08:08
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
It is well known "RAPID FIRE".
Simple variant:It is quite simple: set triger then loop while triger.
Timed variant:In this case script is free to make other actions (less CPU usage). My Favorit! https://autohotkey.com/board/topic/9324 ... pts-howto/
Enjoy!
Simple variant:
Code: Select all
#SingleInstance Force
SetKeyDelay(10, 10) ;the best way to set press and delay in sending
;send(key)
;sleep(10)
;use SetKeyDelay instead of send and sleep
#MaxThreadsPerHotkey 2 ;must for break while
F4::
arm:=!arm
while arm {
tooltip("12345") ; visual debug
;send("12345") ; uncomment to activate send
sleep(200) ; 200 ms to next send
tooltip() ; visual debug
}
RETURN
#!Q::ExitApp ;Win + Alt + Q to exit
Timed variant:
Code: Select all
#SingleInstance Force
SetKeyDelay(10, 10) ;the best way to set press and delay in sending
;send(key)
;sleep(10)
;use SetKeyDelay instead of send and sleep
F3::
Armed:=!Armed ;triger that armed disarmed sending
RAPIDFIRE:
setTimer("RAPIDFIRE", "OFF")
tooltip() ; visual debug
if Armed {
tooltip("12345") ; visual debug
;send("12345") ; uncomment to activate sending
setTimer("RAPIDFIRE", 200) ;200 ms to next send
}
RETURN
#!Q::ExitApp ;Win + Alt + Q to exit
Enjoy!
AHKv2.0 alpha forever.
-
- Posts: 12
- Joined: 07 Jan 2018, 08:08
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
https://imgur.com/U1XgGV3
it didn't work man i don't know why but can you please help me once again?
it didn't work man i don't know why but can you please help me once again?
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
Sorry it is AHKv2.0 syntax.
Next code is tested with AutoHotkey_1.1.28.00.
Enjoy!
[Edit] I uncomment send for you. Donload code again and test again.
Next code is tested with AutoHotkey_1.1.28.00.
Code: Select all
#SingleInstance Force
SetKeyDelay 10, 10 ;the best way to set press and delay in sending
F3::
Armed:=!Armed ;triger that armed disarmed sending
RAPIDFIRE:
setTimer RAPIDFIRE, OFF
;tooltip ; visual debug
if Armed {
;tooltip 12345 ; visual debug
send 12345 ; uncomment to activate sending
setTimer RAPIDFIRE, 200 ;200 ms to next send
}
RETURN
#MaxThreadsPerHotkey 2
F4::
arm:=!arm
while arm {
;tooltip 12345 ; visual debug
send 12345 ; uncomment to activate send
sleep 200 ; 200 ms to next send
;tooltip ; visual debug
}
RETURN
#!Q::ExitApp ;Win + Alt + Q to exit
[Edit] I uncomment send for you. Donload code again and test again.
Last edited by _3D_ on 05 Mar 2018, 14:53, edited 1 time in total.
AHKv2.0 alpha forever.
-
- Posts: 12
- Joined: 07 Jan 2018, 08:08
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
it didn't gave an error but in the screen it shows as a message text like 12345 see in the picture,what i want is the 1,2,3,4,5 buttons to be pressed not from the numpad but from the symbols xD like 1 from ! 2 from @ 3 from # xD i am sorry
https://imgur.com/Y6WDHpB
https://imgur.com/Y6WDHpB
-
- Posts: 12
- Joined: 07 Jan 2018, 08:08
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
oh well i fixed it like this : but it still it does not work in game like why
Code: Select all
#SingleInstance Force
SetKeyDelay 10, 10 ;the best way to set press and delay in sending
F3::
Armed:=!Armed ;triger that armed disarmed sending
RAPIDFIRE:
setTimer RAPIDFIRE, OFF
tooltip ; visual debug
if Armed {
Send, {1}
Sleep, 3
Send, {2}
Sleep, 3
Send, {3}
Sleep, 3
Send, {4}
Sleep, 3
Send, {5}
Sleep, 3 ; uncomment to activate sending
setTimer RAPIDFIRE, 200 ;200 ms to next send
}
RETURN
#MaxThreadsPerHotkey 2
F4::
arm:=!arm
while arm {
Send, {1}
Sleep, 3
Send, {2}
Sleep, 3
Send, {3}
Sleep, 3
Send, {4}
Sleep, 3
Send, {5}
Sleep, 3
}
RETURN
#!Q::ExitApp ;Win + Alt + Q to exit
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
I Correct code to send instead of show 12345 download and try again.
Why script cant work in game?
1. If you run 64 bit Windows - use 64 bit Autohotkey.
2. Make Autohotkey (Run as Administrator).
3. You need to tune up pressing and holding down key (probably you send buttons tooooooo fast and game machine think it is BOT). SetKeyDelay 80, 80 (for example).
Generally:
- game machine think that you are BOT if you send buttons shorter than 80ms (3ms is tooooooo fast).
- game machine have software defender against script languages
how to avoid?
see 1. and 2.
- try different send methods https://autohotkey.com/docs/commands/SendMode.htm
- most games is 32 bit and running 64 bit script interpreters solve sending problems.
Send 1 ;send 1
Send {Numpad1} ;send 1 from numpad
Why script cant work in game?
1. If you run 64 bit Windows - use 64 bit Autohotkey.
2. Make Autohotkey (Run as Administrator).
3. You need to tune up pressing and holding down key (probably you send buttons tooooooo fast and game machine think it is BOT). SetKeyDelay 80, 80 (for example).
Generally:
- game machine think that you are BOT if you send buttons shorter than 80ms (3ms is tooooooo fast).
- game machine have software defender against script languages
how to avoid?
see 1. and 2.
- try different send methods https://autohotkey.com/docs/commands/SendMode.htm
- most games is 32 bit and running 64 bit script interpreters solve sending problems.
Send 1 ;send 1
Send {Numpad1} ;send 1 from numpad
AHKv2.0 alpha forever.
-
- Posts: 12
- Joined: 07 Jan 2018, 08:08
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
awesome man i don't know how it worked i set the 80,80, and plus at sleep added 200ms and run it as an administrator but thank you so much if you had given up on me i wouldn't know the solution and since you are helpful do you by any chance also know unity3d?_3D_ wrote:I Correct code to send instead of show 12345 download and try again.
Why script cant work in game?
1. If you run 64 bit Windows - use 64 bit Autohotkey.
2. Make Autohotkey (Run as Administrator).
3. You need to tune up pressing and holding down key (probably you send buttons tooooooo fast and game machine think it is BOT). SetKeyDelay 80, 80 (for example).
Generally:
- game machine think that you are BOT if you send buttons shorter than 80ms (3ms is tooooooo fast).
- game machine have software defender against script languages
how to avoid?
see 1. and 2.
- try different send methods https://autohotkey.com/docs/commands/SendMode.htm
- most games is 32 bit and running 64 bit script interpreters solve sending problems.
Send 1 ;send 1
Send {Numpad1} ;send 1 from numpad
-
- Posts: 12
- Joined: 07 Jan 2018, 08:08
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
It seems for some reason it stopped working like it works but it does not stop anymore and goes on infinite loop
Re: When press F3 to loop 1,2,3,4,5 and when press again F3 to stop
Yep F4:: will produce infinity loop WHY?
By default You can call only 1 instance of hotkey - it mean that second call will be ignored.#MaxThreadsPerHotkey will allow second instance of any hotkey
By default You can call only 1 instance of hotkey - it mean that second call will be ignored.
Code: Select all
#MaxThreadsPerHotkey 2 ;allow second call of F4::
cnt:=0
F4::
arm:=!arm
while arm {
tooltip arm " [ " cnt++ " ]"
sleep 50
}
;after loop
tooltip
RETURN
AHKv2.0 alpha forever.
Who is online
Users browsing this forum: No registered users and 77 guests