Add error handling to autotype
This commit is contained in:
parent
d09cc377cd
commit
3a4bc1c732
|
@ -11,362 +11,363 @@ type Dvorak struct {
|
|||
}
|
||||
|
||||
func (d Dvorak) TypeKey(key Key, keyboard uinput.Keyboard) error {
|
||||
var err error
|
||||
switch key {
|
||||
case KeyA:
|
||||
keyboard.KeyPress(uinput.KeyA)
|
||||
err = keyboard.KeyPress(uinput.KeyA)
|
||||
break
|
||||
case KeyAUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyA)
|
||||
err = keyboard.KeyPress(uinput.KeyA)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyB:
|
||||
keyboard.KeyPress(uinput.KeyN)
|
||||
err = keyboard.KeyPress(uinput.KeyN)
|
||||
break
|
||||
case KeyBUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyN)
|
||||
err = keyboard.KeyPress(uinput.KeyN)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyC:
|
||||
keyboard.KeyPress(uinput.KeyI)
|
||||
err = keyboard.KeyPress(uinput.KeyI)
|
||||
break
|
||||
case KeyCUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyI)
|
||||
err = keyboard.KeyPress(uinput.KeyI)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyD:
|
||||
keyboard.KeyPress(uinput.KeyH)
|
||||
err = keyboard.KeyPress(uinput.KeyH)
|
||||
break
|
||||
case KeyDUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyH)
|
||||
err = keyboard.KeyPress(uinput.KeyH)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyE:
|
||||
keyboard.KeyPress(uinput.KeyD)
|
||||
err = keyboard.KeyPress(uinput.KeyD)
|
||||
break
|
||||
case KeyEUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
keyboard.KeyPress(uinput.KeyD)
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyPress(uinput.KeyD)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyF:
|
||||
keyboard.KeyPress(uinput.KeyY)
|
||||
err = keyboard.KeyPress(uinput.KeyY)
|
||||
break
|
||||
case KeyFUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyY)
|
||||
err = keyboard.KeyPress(uinput.KeyY)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyG:
|
||||
keyboard.KeyPress(uinput.KeyU)
|
||||
err = keyboard.KeyPress(uinput.KeyU)
|
||||
break
|
||||
case KeyGUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyU)
|
||||
err = keyboard.KeyPress(uinput.KeyU)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyH:
|
||||
keyboard.KeyPress(uinput.KeyJ)
|
||||
err = keyboard.KeyPress(uinput.KeyJ)
|
||||
break
|
||||
case KeyHUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyJ)
|
||||
err = keyboard.KeyPress(uinput.KeyJ)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyI:
|
||||
keyboard.KeyPress(uinput.KeyG)
|
||||
err = keyboard.KeyPress(uinput.KeyG)
|
||||
break
|
||||
case KeyIUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyG)
|
||||
err = keyboard.KeyPress(uinput.KeyG)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyJ:
|
||||
keyboard.KeyPress(uinput.KeyC)
|
||||
err = keyboard.KeyPress(uinput.KeyC)
|
||||
break
|
||||
case KeyJUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyC)
|
||||
err = keyboard.KeyPress(uinput.KeyC)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyK:
|
||||
keyboard.KeyPress(uinput.KeyV)
|
||||
err = keyboard.KeyPress(uinput.KeyV)
|
||||
break
|
||||
case KeyKUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyV)
|
||||
err = keyboard.KeyPress(uinput.KeyV)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyL:
|
||||
keyboard.KeyPress(uinput.KeyP)
|
||||
err = keyboard.KeyPress(uinput.KeyP)
|
||||
break
|
||||
case KeyLUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyP)
|
||||
err = keyboard.KeyPress(uinput.KeyP)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyM:
|
||||
keyboard.KeyPress(uinput.KeyM)
|
||||
err = keyboard.KeyPress(uinput.KeyM)
|
||||
break
|
||||
case KeyMUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyM)
|
||||
err = keyboard.KeyPress(uinput.KeyM)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyN:
|
||||
keyboard.KeyPress(uinput.KeyL)
|
||||
err = keyboard.KeyPress(uinput.KeyL)
|
||||
break
|
||||
case KeyNUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyL)
|
||||
err = keyboard.KeyPress(uinput.KeyL)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyO:
|
||||
keyboard.KeyPress(uinput.KeyS)
|
||||
err = keyboard.KeyPress(uinput.KeyS)
|
||||
break
|
||||
case KeyOUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyS)
|
||||
err = keyboard.KeyPress(uinput.KeyS)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyP:
|
||||
keyboard.KeyPress(uinput.KeyR)
|
||||
err = keyboard.KeyPress(uinput.KeyR)
|
||||
break
|
||||
case KeyPUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyR)
|
||||
err = keyboard.KeyPress(uinput.KeyR)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyQ:
|
||||
keyboard.KeyPress(uinput.KeyX)
|
||||
err = keyboard.KeyPress(uinput.KeyX)
|
||||
break
|
||||
case KeyQUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyX)
|
||||
err = keyboard.KeyPress(uinput.KeyX)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyR:
|
||||
keyboard.KeyPress(uinput.KeyO)
|
||||
err = keyboard.KeyPress(uinput.KeyO)
|
||||
break
|
||||
case KeyRUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyO)
|
||||
err = keyboard.KeyPress(uinput.KeyO)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyS:
|
||||
keyboard.KeyPress(uinput.KeySemicolon)
|
||||
err = keyboard.KeyPress(uinput.KeySemicolon)
|
||||
break
|
||||
case KeySUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeySemicolon)
|
||||
err = keyboard.KeyPress(uinput.KeySemicolon)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyT:
|
||||
keyboard.KeyPress(uinput.KeyK)
|
||||
err = keyboard.KeyPress(uinput.KeyK)
|
||||
break
|
||||
case KeyTUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyK)
|
||||
err = keyboard.KeyPress(uinput.KeyK)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyU:
|
||||
keyboard.KeyPress(uinput.KeyF)
|
||||
err = keyboard.KeyPress(uinput.KeyF)
|
||||
break
|
||||
case KeyUUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyF)
|
||||
err = keyboard.KeyPress(uinput.KeyF)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyV:
|
||||
keyboard.KeyPress(uinput.KeyDot)
|
||||
err = keyboard.KeyPress(uinput.KeyDot)
|
||||
break
|
||||
case KeyVUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyDot)
|
||||
err = keyboard.KeyPress(uinput.KeyDot)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyW:
|
||||
keyboard.KeyPress(uinput.KeyComma)
|
||||
err = keyboard.KeyPress(uinput.KeyComma)
|
||||
break
|
||||
case KeyWUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyComma)
|
||||
err = keyboard.KeyPress(uinput.KeyComma)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyX:
|
||||
keyboard.KeyPress(uinput.KeyB)
|
||||
err = keyboard.KeyPress(uinput.KeyB)
|
||||
break
|
||||
case KeyXUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyB)
|
||||
err = keyboard.KeyPress(uinput.KeyB)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyY:
|
||||
keyboard.KeyPress(uinput.KeyT)
|
||||
err = keyboard.KeyPress(uinput.KeyT)
|
||||
break
|
||||
case KeyYUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyT)
|
||||
err = keyboard.KeyPress(uinput.KeyT)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyZ:
|
||||
keyboard.KeyPress(uinput.KeySlash)
|
||||
err = keyboard.KeyPress(uinput.KeySlash)
|
||||
break
|
||||
case KeyZUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeySlash)
|
||||
err = keyboard.KeyPress(uinput.KeySlash)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case Key1:
|
||||
keyboard.KeyPress(uinput.Key1)
|
||||
err = keyboard.KeyPress(uinput.Key1)
|
||||
break
|
||||
case Key2:
|
||||
keyboard.KeyPress(uinput.Key2)
|
||||
err = keyboard.KeyPress(uinput.Key2)
|
||||
break
|
||||
case Key3:
|
||||
keyboard.KeyPress(uinput.Key3)
|
||||
err = keyboard.KeyPress(uinput.Key3)
|
||||
break
|
||||
case Key4:
|
||||
keyboard.KeyPress(uinput.Key4)
|
||||
err = keyboard.KeyPress(uinput.Key4)
|
||||
break
|
||||
case Key5:
|
||||
keyboard.KeyPress(uinput.Key5)
|
||||
err = keyboard.KeyPress(uinput.Key5)
|
||||
break
|
||||
case Key6:
|
||||
keyboard.KeyPress(uinput.Key6)
|
||||
err = keyboard.KeyPress(uinput.Key6)
|
||||
break
|
||||
case Key7:
|
||||
keyboard.KeyPress(uinput.Key7)
|
||||
err = keyboard.KeyPress(uinput.Key7)
|
||||
break
|
||||
case Key8:
|
||||
keyboard.KeyPress(uinput.Key8)
|
||||
err = keyboard.KeyPress(uinput.Key8)
|
||||
break
|
||||
case Key9:
|
||||
keyboard.KeyPress(uinput.Key9)
|
||||
err = keyboard.KeyPress(uinput.Key9)
|
||||
break
|
||||
case Key0:
|
||||
keyboard.KeyPress(uinput.Key0)
|
||||
err = keyboard.KeyPress(uinput.Key0)
|
||||
break
|
||||
case KeyTab:
|
||||
keyboard.KeyPress(uinput.KeyTab)
|
||||
err = keyboard.KeyPress(uinput.KeyTab)
|
||||
break
|
||||
case KeyHyphen:
|
||||
keyboard.KeyPress(uinput.KeyApostrophe)
|
||||
err = keyboard.KeyPress(uinput.KeyApostrophe)
|
||||
break
|
||||
case KeyExclamationMark:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key1)
|
||||
err = keyboard.KeyPress(uinput.Key1)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyAtSign:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key2)
|
||||
err = keyboard.KeyPress(uinput.Key2)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyHash:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key3)
|
||||
err = keyboard.KeyPress(uinput.Key3)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyDollar:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key4)
|
||||
err = keyboard.KeyPress(uinput.Key4)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyPercent:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key5)
|
||||
err = keyboard.KeyPress(uinput.Key5)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyCaret:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key6)
|
||||
err = keyboard.KeyPress(uinput.Key6)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyAmpersand:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key7)
|
||||
err = keyboard.KeyPress(uinput.Key7)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyAsterisk:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key8)
|
||||
err = keyboard.KeyPress(uinput.Key8)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyDot:
|
||||
keyboard.KeyPress(uinput.KeyE)
|
||||
err = keyboard.KeyPress(uinput.KeyE)
|
||||
break
|
||||
case KeyComma:
|
||||
keyboard.KeyPress(uinput.KeyW)
|
||||
err = keyboard.KeyPress(uinput.KeyW)
|
||||
break
|
||||
case KeyQuestionMark:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyLeftbrace)
|
||||
err = keyboard.KeyPress(uinput.KeyLeftbrace)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeySemicolon:
|
||||
keyboard.KeyPress(uinput.KeyZ)
|
||||
err = keyboard.KeyPress(uinput.KeyZ)
|
||||
break
|
||||
case KeyColon:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyZ)
|
||||
err = keyboard.KeyPress(uinput.KeyZ)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeySlash:
|
||||
keyboard.KeyPress(uinput.KeyLeftbrace)
|
||||
err = keyboard.KeyPress(uinput.KeyLeftbrace)
|
||||
break
|
||||
case KeyApostrophe:
|
||||
keyboard.KeyPress(uinput.KeyQ)
|
||||
err = keyboard.KeyPress(uinput.KeyQ)
|
||||
break
|
||||
case KeySpace:
|
||||
keyboard.KeyPress(uinput.KeySpace)
|
||||
err = keyboard.KeyPress(uinput.KeySpace)
|
||||
break
|
||||
|
||||
default:
|
||||
|
@ -375,7 +376,7 @@ func (d Dvorak) TypeKey(key Key, keyboard uinput.Keyboard) error {
|
|||
return errors.New("Unknown key")
|
||||
}
|
||||
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -11,365 +11,367 @@ type Qwerty struct {
|
|||
}
|
||||
|
||||
func (d Qwerty) TypeKey(key Key, keyboard uinput.Keyboard) error {
|
||||
var err error
|
||||
|
||||
switch key {
|
||||
case KeyA:
|
||||
keyboard.KeyPress(uinput.KeyA)
|
||||
err = keyboard.KeyPress(uinput.KeyA)
|
||||
break
|
||||
case KeyAUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyA)
|
||||
err = keyboard.KeyPress(uinput.KeyA)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyB:
|
||||
keyboard.KeyPress(uinput.KeyB)
|
||||
err = keyboard.KeyPress(uinput.KeyB)
|
||||
break
|
||||
case KeyBUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyB)
|
||||
err = keyboard.KeyPress(uinput.KeyB)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyC:
|
||||
keyboard.KeyPress(uinput.KeyC)
|
||||
err = keyboard.KeyPress(uinput.KeyC)
|
||||
break
|
||||
case KeyCUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyC)
|
||||
err = keyboard.KeyPress(uinput.KeyC)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyD:
|
||||
keyboard.KeyPress(uinput.KeyD)
|
||||
err = keyboard.KeyPress(uinput.KeyD)
|
||||
break
|
||||
case KeyDUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyD)
|
||||
err = keyboard.KeyPress(uinput.KeyD)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyE:
|
||||
keyboard.KeyPress(uinput.KeyE)
|
||||
err = keyboard.KeyPress(uinput.KeyE)
|
||||
break
|
||||
case KeyEUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyE)
|
||||
err = keyboard.KeyPress(uinput.KeyE)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyF:
|
||||
keyboard.KeyPress(uinput.KeyF)
|
||||
err = keyboard.KeyPress(uinput.KeyF)
|
||||
break
|
||||
case KeyFUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyF)
|
||||
err = keyboard.KeyPress(uinput.KeyF)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyG:
|
||||
keyboard.KeyPress(uinput.KeyG)
|
||||
err = keyboard.KeyPress(uinput.KeyG)
|
||||
break
|
||||
case KeyGUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyG)
|
||||
err = keyboard.KeyPress(uinput.KeyG)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyH:
|
||||
keyboard.KeyPress(uinput.KeyH)
|
||||
err = keyboard.KeyPress(uinput.KeyH)
|
||||
break
|
||||
case KeyHUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyH)
|
||||
err = keyboard.KeyPress(uinput.KeyH)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyI:
|
||||
keyboard.KeyPress(uinput.KeyI)
|
||||
err = keyboard.KeyPress(uinput.KeyI)
|
||||
break
|
||||
case KeyIUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyI)
|
||||
err = keyboard.KeyPress(uinput.KeyI)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyJ:
|
||||
keyboard.KeyPress(uinput.KeyJ)
|
||||
err = keyboard.KeyPress(uinput.KeyJ)
|
||||
break
|
||||
case KeyJUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyJ)
|
||||
err = keyboard.KeyPress(uinput.KeyJ)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyK:
|
||||
keyboard.KeyPress(uinput.KeyK)
|
||||
err = keyboard.KeyPress(uinput.KeyK)
|
||||
break
|
||||
case KeyKUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyK)
|
||||
err = keyboard.KeyPress(uinput.KeyK)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyL:
|
||||
keyboard.KeyPress(uinput.KeyL)
|
||||
err = keyboard.KeyPress(uinput.KeyL)
|
||||
break
|
||||
case KeyLUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyL)
|
||||
err = keyboard.KeyPress(uinput.KeyL)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyM:
|
||||
keyboard.KeyPress(uinput.KeyM)
|
||||
err = keyboard.KeyPress(uinput.KeyM)
|
||||
break
|
||||
case KeyMUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyM)
|
||||
err = keyboard.KeyPress(uinput.KeyM)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyN:
|
||||
keyboard.KeyPress(uinput.KeyN)
|
||||
err = keyboard.KeyPress(uinput.KeyN)
|
||||
break
|
||||
case KeyNUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyN)
|
||||
err = keyboard.KeyPress(uinput.KeyN)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyO:
|
||||
keyboard.KeyPress(uinput.KeyO)
|
||||
err = keyboard.KeyPress(uinput.KeyO)
|
||||
break
|
||||
case KeyOUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyO)
|
||||
err = keyboard.KeyPress(uinput.KeyO)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyP:
|
||||
keyboard.KeyPress(uinput.KeyP)
|
||||
err = keyboard.KeyPress(uinput.KeyP)
|
||||
break
|
||||
case KeyPUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyP)
|
||||
err = keyboard.KeyPress(uinput.KeyP)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyQ:
|
||||
keyboard.KeyPress(uinput.KeyQ)
|
||||
err = keyboard.KeyPress(uinput.KeyQ)
|
||||
break
|
||||
case KeyQUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyQ)
|
||||
err = keyboard.KeyPress(uinput.KeyQ)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyR:
|
||||
keyboard.KeyPress(uinput.KeyR)
|
||||
err = keyboard.KeyPress(uinput.KeyR)
|
||||
break
|
||||
case KeyRUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyR)
|
||||
err = keyboard.KeyPress(uinput.KeyR)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyS:
|
||||
keyboard.KeyPress(uinput.KeyS)
|
||||
err = keyboard.KeyPress(uinput.KeyS)
|
||||
break
|
||||
case KeySUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyS)
|
||||
err = keyboard.KeyPress(uinput.KeyS)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyT:
|
||||
keyboard.KeyPress(uinput.KeyT)
|
||||
err = keyboard.KeyPress(uinput.KeyT)
|
||||
break
|
||||
case KeyTUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyT)
|
||||
err = keyboard.KeyPress(uinput.KeyT)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyU:
|
||||
keyboard.KeyPress(uinput.KeyU)
|
||||
err = keyboard.KeyPress(uinput.KeyU)
|
||||
break
|
||||
case KeyUUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyU)
|
||||
err = keyboard.KeyPress(uinput.KeyU)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyV:
|
||||
keyboard.KeyPress(uinput.KeyV)
|
||||
err = keyboard.KeyPress(uinput.KeyV)
|
||||
break
|
||||
case KeyVUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyV)
|
||||
err = keyboard.KeyPress(uinput.KeyV)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyW:
|
||||
keyboard.KeyPress(uinput.KeyW)
|
||||
err = keyboard.KeyPress(uinput.KeyW)
|
||||
break
|
||||
case KeyWUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyW)
|
||||
err = keyboard.KeyPress(uinput.KeyW)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyX:
|
||||
keyboard.KeyPress(uinput.KeyX)
|
||||
err = keyboard.KeyPress(uinput.KeyX)
|
||||
break
|
||||
case KeyXUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyX)
|
||||
err = keyboard.KeyPress(uinput.KeyX)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyY:
|
||||
keyboard.KeyPress(uinput.KeyY)
|
||||
err = keyboard.KeyPress(uinput.KeyY)
|
||||
break
|
||||
case KeyYUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyY)
|
||||
err = keyboard.KeyPress(uinput.KeyY)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case KeyZ:
|
||||
keyboard.KeyPress(uinput.KeyZ)
|
||||
err = keyboard.KeyPress(uinput.KeyZ)
|
||||
break
|
||||
case KeyZUpper:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeyZ)
|
||||
err = keyboard.KeyPress(uinput.KeyZ)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
case Key1:
|
||||
keyboard.KeyPress(uinput.Key1)
|
||||
err = keyboard.KeyPress(uinput.Key1)
|
||||
break
|
||||
case Key2:
|
||||
keyboard.KeyPress(uinput.Key2)
|
||||
err = keyboard.KeyPress(uinput.Key2)
|
||||
break
|
||||
case Key3:
|
||||
keyboard.KeyPress(uinput.Key3)
|
||||
err = keyboard.KeyPress(uinput.Key3)
|
||||
break
|
||||
case Key4:
|
||||
keyboard.KeyPress(uinput.Key4)
|
||||
err = keyboard.KeyPress(uinput.Key4)
|
||||
break
|
||||
case Key5:
|
||||
keyboard.KeyPress(uinput.Key5)
|
||||
err = keyboard.KeyPress(uinput.Key5)
|
||||
break
|
||||
case Key6:
|
||||
keyboard.KeyPress(uinput.Key6)
|
||||
err = keyboard.KeyPress(uinput.Key6)
|
||||
break
|
||||
case Key7:
|
||||
keyboard.KeyPress(uinput.Key7)
|
||||
err = keyboard.KeyPress(uinput.Key7)
|
||||
break
|
||||
case Key8:
|
||||
keyboard.KeyPress(uinput.Key8)
|
||||
err = keyboard.KeyPress(uinput.Key8)
|
||||
break
|
||||
case Key9:
|
||||
keyboard.KeyPress(uinput.Key9)
|
||||
err = keyboard.KeyPress(uinput.Key9)
|
||||
break
|
||||
case Key0:
|
||||
keyboard.KeyPress(uinput.Key0)
|
||||
err = keyboard.KeyPress(uinput.Key0)
|
||||
break
|
||||
case KeyTab:
|
||||
keyboard.KeyPress(uinput.KeyTab)
|
||||
err = keyboard.KeyPress(uinput.KeyTab)
|
||||
break
|
||||
case KeyHyphen:
|
||||
keyboard.KeyPress(uinput.KeyMinus)
|
||||
err = keyboard.KeyPress(uinput.KeyMinus)
|
||||
break
|
||||
case KeyExclamationMark:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key1)
|
||||
err = keyboard.KeyPress(uinput.Key1)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyAtSign:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key2)
|
||||
err = keyboard.KeyPress(uinput.Key2)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyHash:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key3)
|
||||
err = keyboard.KeyPress(uinput.Key3)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyDollar:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key4)
|
||||
err = keyboard.KeyPress(uinput.Key4)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyPercent:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key5)
|
||||
err = keyboard.KeyPress(uinput.Key5)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyCaret:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key6)
|
||||
err = keyboard.KeyPress(uinput.Key6)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyAmpersand:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key7)
|
||||
err = keyboard.KeyPress(uinput.Key7)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyAsterisk:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.Key8)
|
||||
err = keyboard.KeyPress(uinput.Key8)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeyDot:
|
||||
keyboard.KeyPress(uinput.KeyDot)
|
||||
err = keyboard.KeyPress(uinput.KeyDot)
|
||||
break
|
||||
case KeyComma:
|
||||
keyboard.KeyPress(uinput.KeyW)
|
||||
err = keyboard.KeyPress(uinput.KeyW)
|
||||
break
|
||||
case KeyQuestionMark:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeySlash)
|
||||
err = keyboard.KeyPress(uinput.KeySlash)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeySemicolon:
|
||||
keyboard.KeyPress(uinput.KeySemicolon)
|
||||
err = keyboard.KeyPress(uinput.KeySemicolon)
|
||||
break
|
||||
case KeyColon:
|
||||
keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyDown(uinput.KeyLeftshift)
|
||||
Sleep()
|
||||
keyboard.KeyPress(uinput.KeySemicolon)
|
||||
err = keyboard.KeyPress(uinput.KeySemicolon)
|
||||
Sleep()
|
||||
keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
err = keyboard.KeyUp(uinput.KeyLeftshift)
|
||||
break
|
||||
case KeySlash:
|
||||
keyboard.KeyPress(uinput.KeySlash)
|
||||
err = keyboard.KeyPress(uinput.KeySlash)
|
||||
break
|
||||
case KeyApostrophe:
|
||||
keyboard.KeyPress(uinput.KeyApostrophe)
|
||||
err = keyboard.KeyPress(uinput.KeyApostrophe)
|
||||
break
|
||||
|
||||
case KeySpace:
|
||||
keyboard.KeyPress(uinput.KeySpace)
|
||||
err = keyboard.KeyPress(uinput.KeySpace)
|
||||
break
|
||||
|
||||
default:
|
||||
|
@ -377,7 +379,7 @@ func (d Qwerty) TypeKey(key Key, keyboard uinput.Keyboard) error {
|
|||
fmt.Println("Please add it to the QWERTY layout")
|
||||
return errors.New("Unknown key")
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
Loading…
Reference in New Issue