0
votes

I want to add to this script so that during the disable period you ccan still use key 4 if you are holding alt shift or cntrl

The code I have disables the 4 key entirely for a duration after it's pressed.

  4WasPressedAt:=A_TickCount-5200       
  ~*4::4WasPressedAt:=A_TickCount       
  #if A_TickCount-4WasPressedAt<5200    
  *4::return

I would like to have it functional if another key is being held down during that time and then the same for the 3 key with a 4.8 second delay.

1

1 Answers

0
votes

This can be done by adding more conditions to your #If. Please see my solution below. Note that a possible shortcoming is that the combinations of alt+4, shift+4, and ctrl+4 will only produce a 4. That is, the possible expected effect of typing those combinations, such as shift+4 to get $, will only produce a 4.

4WasPressedAt := A_TickCount - 5200

$*4::
4WasPressedAt := A_TickCount
Send , {4}
Return

#If (( A_TickCount - 4WasPressedAt ) < 5200 && !( GetKeyState( "Alt" ) || GetKeyState( "Shift" ) || GetKeyState( "Ctrl" )))
*4::Return
#If