mirror of
https://github.com/RoganDawes/P4wnP1_aloa.git
synced 2025-03-17 13:21:50 +01:00
Fix: random jitter for command
This commit is contained in:
parent
2bf2596fad
commit
ffca3c079f
@ -407,7 +407,7 @@ func (ctl *HIDController) jsLayout(call otto.FunctionCall) (res otto.Value) {
|
||||
func (ctl *HIDController) jsTypingSpeed(call otto.FunctionCall) (res otto.Value) {
|
||||
if ctl.Keyboard == nil { log.Println(ErrNoKeyboard); oErr,_ := otto.ToValue(ErrNoKeyboard); return oErr }
|
||||
typeDelay := call.Argument(0) //delay between keypresses in milliseconds
|
||||
typeJitter := call.Argument(0) //additional random jitter between keypresses, maximum in milliseconds
|
||||
typeJitter := call.Argument(1) //additional random jitter between keypresses, maximum in milliseconds
|
||||
|
||||
if delay,err:= typeDelay.ToInteger();err != nil || delay < 0 {
|
||||
log.Printf("HIDScript typingSpeed: First argument has to be positive integer, representing the delay between key presses in milliseconds\n")
|
||||
|
@ -413,7 +413,6 @@ func (kbd *HIDKeyboard) PressKeySequence(reports []KeyboardOutReport) (err error
|
||||
delay := kbd.KeyDelay
|
||||
if kbd.KeyDelayJitter > 0 { delay += rand.Intn(kbd.KeyDelayJitter)}
|
||||
if delay > 0 { time.Sleep(time.Millisecond * time.Duration(delay)) }
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user