I need a faster version of this

Get help with using AutoHotkey and its commands and hotkeys
Darkspectro
Posts: 9
Joined: 05 May 2018, 22:35

I need a faster version of this

24 Nov 2020, 07:26

Code: Select all

;keyboard speed up
~$*F1:: sendinput :disparar x{enter}
~$*F2:: sendinput x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}
~$*F3:: sendinput :recargar{enter}
~$*F4:: sendinput x{enter}x{enter}:equipar akmsu{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}
~$*F5:: sendinput :equipar akmsu{enter}
~$*F6:: sendinput :equipar rpg{enter}
~$*ESC:: sendinput :conducir pcs1e{enter}
~$*F9:: sendinput :disparar pepito{enter}:equipar akmsu{enter}x{enter}x{enter}x{enter}xx{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}
~$*F10:: sendinput :disparar jose{enter}:equipar akmsu{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}
~$*F11:: sendinput :disparar juana{enter}:equipar akmsu{enter}x{enter}x{enter}x{enter}x{enter}x{enter}x{enter}{enter}x{enter}x{enter}x{enter}


StringTrimLeft, ks_key, A_ThisHotkey, 3
process_key(ks_key)
return

process_key(ks_key) {

	ks_key_to_send = %ks_key%

	; sending a special key?  if so, wrap in brackets
	ks_length := StrLen(ks_key)

	if (ks_length > 1) {
		ks_key_to_send = {%ks_key%}
	}

	ks_TimeButtonDown = %A_TickCount%
	ks_break = false

	; Wait for it to be released
	Loop {
		Sleep -1

		ks_elapsed = %A_TickCount%
		ks_elapsed -= %ks_TimeButtonDown%

		GetKeyState, ks_keystate, %ks_key%, P

	  	; Button has been released.
		IfEqual ks_keystate, U, {
			break
		}

		; wait for delay to be done
		if (ks_elapsed > -1) {

			Loop {

				Sleep -1

				GetKeyState, ks_keystate, %ks_key%, P

			  	; Button has been released.
				IfEqual ks_keystate, U, {
					break = true
					break
				}


				SendInput, {Blind}%ks_key_to_send%

			}
		}

		IfEqual break, true, {
			break
		}

	}

}
;OPTIMIZATIONS START
#NoEnv
#MaxHotkeysPerInterval 1
#HotkeyInterval 1
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetKeyDelay, -1
SetBatchLines, -1
SetTitleMatchMode 1
SetTitleMatchMode Fast
SetKeyDelay, -1, Play
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
SendMode event
SetKeyDelay, -1
SetBatchLines, 1
SetTitleMatchMode 1
SetTitleMatchMode Fast
SetKeyDelay, 1, Play
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, 1
SetControlDelay, 1
SendMode Input
SendMode event
;OPTIMIZATIONS END
[Mod edit: [code][/code] tags added.]
User avatar
Chunjee
Posts: 754
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

Re: I need a faster version of this

24 Nov 2020, 16:07

does ;OPTIMIZATIONS START even work at the bottom of the script? lol

Return to “Ask For Help”

Who is online

Users browsing this forum: DarkKitten, LeroyMcCheeks, malcev, TAC109, teadrinker, Yamiko_Hikari and 50 guests