Add support for ctrl, shift and alt keys.
Add support for using ctrl, shift and alt as key modifiers. So you can now achieve ctrl+c by using "<leftCtrlOn>c<leftCtrlOff>". Updated documentation for new key stroke tokens.
This commit is contained in:
parent
644b11805d
commit
a87ad05866
@ -186,6 +186,13 @@ func scancodes(message string) []string {
|
|||||||
special["<pageUp>"] = []string{"49", "c9"}
|
special["<pageUp>"] = []string{"49", "c9"}
|
||||||
special["<pageDown>"] = []string{"51", "d1"}
|
special["<pageDown>"] = []string{"51", "d1"}
|
||||||
|
|
||||||
|
special["<leftAlt>"] = []string{"38", "b8"}
|
||||||
|
special["<leftCtrl>"] = []string{"1d", "9d"}
|
||||||
|
special["<leftShift>"] = []string{"2a", "aa"}
|
||||||
|
special["<rightAlt>"] = []string{"e038", "e0b8"}
|
||||||
|
special["<rightCtrl>"] = []string{"e01d", "e09d"}
|
||||||
|
special["<rightShift>"] = []string{"36", "b6"}
|
||||||
|
|
||||||
shiftedChars := "!@#$%^&*()_+{}:\"~|<>?"
|
shiftedChars := "!@#$%^&*()_+{}:\"~|<>?"
|
||||||
|
|
||||||
scancodeIndex := make(map[string]uint)
|
scancodeIndex := make(map[string]uint)
|
||||||
@ -214,6 +221,78 @@ func scancodes(message string) []string {
|
|||||||
for len(message) > 0 {
|
for len(message) > 0 {
|
||||||
var scancode []string
|
var scancode []string
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftAltOn>") {
|
||||||
|
scancode = []string{"38"}
|
||||||
|
message = message[len("<leftAltOn>"):]
|
||||||
|
log.Printf("Special code '<leftAltOn>' found, replacing with: 38")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftCtrlOn>") {
|
||||||
|
scancode = []string{"1d"}
|
||||||
|
message = message[len("<leftCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOn>' found, replacing with: 1d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftShiftOn>") {
|
||||||
|
scancode = []string{"2a"}
|
||||||
|
message = message[len("<leftShiftOn>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOn>' found, replacing with: 2a")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftAltOff>") {
|
||||||
|
scancode = []string{"b8"}
|
||||||
|
message = message[len("<leftAltOff>"):]
|
||||||
|
log.Printf("Special code '<leftAltOff>' found, replacing with: b8")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftCtrlOff>") {
|
||||||
|
scancode = []string{"9d"}
|
||||||
|
message = message[len("<leftCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOff>' found, replacing with: 9d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftShiftOff>") {
|
||||||
|
scancode = []string{"aa"}
|
||||||
|
message = message[len("<leftShiftOff>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOff>' found, replacing with: aa")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightAltOn>") {
|
||||||
|
scancode = []string{"e038"}
|
||||||
|
message = message[len("<rightAltOn>"):]
|
||||||
|
log.Printf("Special code '<rightAltOn>' found, replacing with: e038")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightCtrlOn>") {
|
||||||
|
scancode = []string{"e01d"}
|
||||||
|
message = message[len("<rightCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOn>' found, replacing with: e01d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightShiftOn>") {
|
||||||
|
scancode = []string{"36"}
|
||||||
|
message = message[len("<rightShiftOn>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOn>' found, replacing with: 36")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightAltOff>") {
|
||||||
|
scancode = []string{"e0b8"}
|
||||||
|
message = message[len("<rightAltOff>"):]
|
||||||
|
log.Printf("Special code '<rightAltOff>' found, replacing with: e0b8")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightCtrlOff>") {
|
||||||
|
scancode = []string{"e09d"}
|
||||||
|
message = message[len("<rightCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOff>' found, replacing with: e09d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightShiftOff>") {
|
||||||
|
scancode = []string{"b6"}
|
||||||
|
message = message[len("<rightShiftOff>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOff>' found, replacing with: b6")
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(message, "<wait>") {
|
if strings.HasPrefix(message, "<wait>") {
|
||||||
log.Printf("Special code <wait> found, will sleep 1 second at this point.")
|
log.Printf("Special code <wait> found, will sleep 1 second at this point.")
|
||||||
scancode = []string{"wait"}
|
scancode = []string{"wait"}
|
||||||
|
@ -136,6 +136,12 @@ func vncSendString(c *vnc.ClientConn, original string) {
|
|||||||
special["<end>"] = 0xFF57
|
special["<end>"] = 0xFF57
|
||||||
special["<pageUp>"] = 0xFF55
|
special["<pageUp>"] = 0xFF55
|
||||||
special["<pageDown>"] = 0xFF56
|
special["<pageDown>"] = 0xFF56
|
||||||
|
special["<leftAlt>"] = 0xFFE9
|
||||||
|
special["<leftCtrl>"] = 0xFFE3
|
||||||
|
special["<leftShift>"] = 0xFFE1
|
||||||
|
special["<rightAlt>"] = 0xFFEA
|
||||||
|
special["<rightCtrl>"] = 0xFFE4
|
||||||
|
special["<rightShift>"] = 0xFFE2
|
||||||
|
|
||||||
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
||||||
|
|
||||||
@ -144,6 +150,174 @@ func vncSendString(c *vnc.ClientConn, original string) {
|
|||||||
var keyCode uint32
|
var keyCode uint32
|
||||||
keyShift := false
|
keyShift := false
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftAltOn>") {
|
||||||
|
keyCode = special["<leftAlt>"]
|
||||||
|
original = original[len("<leftAltOn>"):]
|
||||||
|
log.Printf("Special code '<leftAltOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftCtrlOn>") {
|
||||||
|
keyCode = special["<leftCtrlOn>"]
|
||||||
|
original = original[len("<leftCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftShiftOn>") {
|
||||||
|
keyCode = special["<leftShiftOn>"]
|
||||||
|
original = original[len("<leftShiftOn>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftAltOff>") {
|
||||||
|
keyCode = special["<leftAltOff>"]
|
||||||
|
original = original[len("<leftAltOff>"):]
|
||||||
|
log.Printf("Special code '<leftAltOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftCtrlOff>") {
|
||||||
|
keyCode = special["<leftCtrlOff>"]
|
||||||
|
original = original[len("<leftCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftShiftOff>") {
|
||||||
|
keyCode = special["<leftShiftOff>"]
|
||||||
|
original = original[len("<leftShiftOff>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightAltOn>") {
|
||||||
|
keyCode = special["<rightAltOn>"]
|
||||||
|
original = original[len("<rightAltOn>"):]
|
||||||
|
log.Printf("Special code '<rightAltOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightCtrlOn>") {
|
||||||
|
keyCode = special["<rightCtrlOn>"]
|
||||||
|
original = original[len("<rightCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightShiftOn>") {
|
||||||
|
keyCode = special["<rightShiftOn>"]
|
||||||
|
original = original[len("<rightShiftOn>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightAltOff>") {
|
||||||
|
keyCode = special["<rightAltOff>"]
|
||||||
|
original = original[len("<rightAltOff>"):]
|
||||||
|
log.Printf("Special code '<rightAltOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightCtrlOff>") {
|
||||||
|
keyCode = special["<rightCtrlOff>"]
|
||||||
|
original = original[len("<rightCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightShiftOff>") {
|
||||||
|
keyCode = special["<rightShiftOff>"]
|
||||||
|
original = original[len("<rightShiftOff>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
// qemu is picky, so no matter what, wait a small period
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(original, "<wait>") {
|
if strings.HasPrefix(original, "<wait>") {
|
||||||
log.Printf("Special code '<wait>' found, sleeping one second")
|
log.Printf("Special code '<wait>' found, sleeping one second")
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
@ -141,6 +141,12 @@ func scancodes(message string) []string {
|
|||||||
special["<end>"] = []string{"4f", "cf"}
|
special["<end>"] = []string{"4f", "cf"}
|
||||||
special["<pageUp>"] = []string{"49", "c9"}
|
special["<pageUp>"] = []string{"49", "c9"}
|
||||||
special["<pageDown>"] = []string{"51", "d1"}
|
special["<pageDown>"] = []string{"51", "d1"}
|
||||||
|
special["<leftAlt>"] = []string{"38", "b8"}
|
||||||
|
special["<leftCtrl>"] = []string{"1d", "9d"}
|
||||||
|
special["<leftShift>"] = []string{"2a", "aa"}
|
||||||
|
special["<rightAlt>"] = []string{"e038", "e0b8"}
|
||||||
|
special["<rightCtrl>"] = []string{"e01d", "e09d"}
|
||||||
|
special["<rightShift>"] = []string{"36", "b6"}
|
||||||
|
|
||||||
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
||||||
|
|
||||||
@ -170,6 +176,78 @@ func scancodes(message string) []string {
|
|||||||
for len(message) > 0 {
|
for len(message) > 0 {
|
||||||
var scancode []string
|
var scancode []string
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftAltOn>") {
|
||||||
|
scancode = []string{"38"}
|
||||||
|
message = message[len("<leftAltOn>"):]
|
||||||
|
log.Printf("Special code '<leftAltOn>' found, replacing with: 38")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftCtrlOn>") {
|
||||||
|
scancode = []string{"1d"}
|
||||||
|
message = message[len("<leftCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOn>' found, replacing with: 1d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftShiftOn>") {
|
||||||
|
scancode = []string{"2a"}
|
||||||
|
message = message[len("<leftShiftOn>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOn>' found, replacing with: 2a")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftAltOff>") {
|
||||||
|
scancode = []string{"b8"}
|
||||||
|
message = message[len("<leftAltOff>"):]
|
||||||
|
log.Printf("Special code '<leftAltOff>' found, replacing with: b8")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftCtrlOff>") {
|
||||||
|
scancode = []string{"9d"}
|
||||||
|
message = message[len("<leftCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOff>' found, replacing with: 9d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<leftShiftOff>") {
|
||||||
|
scancode = []string{"aa"}
|
||||||
|
message = message[len("<leftShiftOff>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOff>' found, replacing with: aa")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightAltOn>") {
|
||||||
|
scancode = []string{"e038"}
|
||||||
|
message = message[len("<rightAltOn>"):]
|
||||||
|
log.Printf("Special code '<rightAltOn>' found, replacing with: e038")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightCtrlOn>") {
|
||||||
|
scancode = []string{"e01d"}
|
||||||
|
message = message[len("<rightCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOn>' found, replacing with: e01d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightShiftOn>") {
|
||||||
|
scancode = []string{"36"}
|
||||||
|
message = message[len("<rightShiftOn>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOn>' found, replacing with: 36")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightAltOff>") {
|
||||||
|
scancode = []string{"e0b8"}
|
||||||
|
message = message[len("<rightAltOff>"):]
|
||||||
|
log.Printf("Special code '<rightAltOff>' found, replacing with: e0b8")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightCtrlOff>") {
|
||||||
|
scancode = []string{"e09d"}
|
||||||
|
message = message[len("<rightCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOff>' found, replacing with: e09d")
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(message, "<rightShiftOff>") {
|
||||||
|
scancode = []string{"b6"}
|
||||||
|
message = message[len("<rightShiftOff>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOff>' found, replacing with: b6")
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(message, "<wait>") {
|
if strings.HasPrefix(message, "<wait>") {
|
||||||
log.Printf("Special code <wait> found, will sleep 1 second at this point.")
|
log.Printf("Special code <wait> found, will sleep 1 second at this point.")
|
||||||
scancode = []string{"wait"}
|
scancode = []string{"wait"}
|
||||||
|
@ -159,6 +159,12 @@ func vncSendString(c *vnc.ClientConn, original string) {
|
|||||||
special["<end>"] = 0xFF57
|
special["<end>"] = 0xFF57
|
||||||
special["<pageUp>"] = 0xFF55
|
special["<pageUp>"] = 0xFF55
|
||||||
special["<pageDown>"] = 0xFF56
|
special["<pageDown>"] = 0xFF56
|
||||||
|
special["<leftAlt>"] = 0xFFE9
|
||||||
|
special["<leftCtrl>"] = 0xFFE3
|
||||||
|
special["<leftShift>"] = 0xFFE1
|
||||||
|
special["<rightAlt>"] = 0xFFEA
|
||||||
|
special["<rightCtrl>"] = 0xFFE4
|
||||||
|
special["<rightShift>"] = 0xFFE2
|
||||||
|
|
||||||
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
shiftedChars := "~!@#$%^&*()_+{}|:\"<>?"
|
||||||
|
|
||||||
@ -167,6 +173,138 @@ func vncSendString(c *vnc.ClientConn, original string) {
|
|||||||
var keyCode uint32
|
var keyCode uint32
|
||||||
keyShift := false
|
keyShift := false
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftAltOn>") {
|
||||||
|
keyCode = special["<leftAlt>"]
|
||||||
|
original = original[len("<leftAltOn>"):]
|
||||||
|
log.Printf("Special code '<leftAltOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftCtrlOn>") {
|
||||||
|
keyCode = special["<leftCtrlOn>"]
|
||||||
|
original = original[len("<leftCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftShiftOn>") {
|
||||||
|
keyCode = special["<leftShiftOn>"]
|
||||||
|
original = original[len("<leftShiftOn>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftAltOff>") {
|
||||||
|
keyCode = special["<leftAltOff>"]
|
||||||
|
original = original[len("<leftAltOff>"):]
|
||||||
|
log.Printf("Special code '<leftAltOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftCtrlOff>") {
|
||||||
|
keyCode = special["<leftCtrlOff>"]
|
||||||
|
original = original[len("<leftCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<leftCtrlOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<leftShiftOff>") {
|
||||||
|
keyCode = special["<leftShiftOff>"]
|
||||||
|
original = original[len("<leftShiftOff>"):]
|
||||||
|
log.Printf("Special code '<leftShiftOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightAltOn>") {
|
||||||
|
keyCode = special["<rightAltOn>"]
|
||||||
|
original = original[len("<rightAltOn>"):]
|
||||||
|
log.Printf("Special code '<rightAltOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightCtrlOn>") {
|
||||||
|
keyCode = special["<rightCtrlOn>"]
|
||||||
|
original = original[len("<rightCtrlOn>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightShiftOn>") {
|
||||||
|
keyCode = special["<rightShiftOn>"]
|
||||||
|
original = original[len("<rightShiftOn>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOn>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, true)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightAltOff>") {
|
||||||
|
keyCode = special["<rightAltOff>"]
|
||||||
|
original = original[len("<rightAltOff>"):]
|
||||||
|
log.Printf("Special code '<rightAltOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightCtrlOff>") {
|
||||||
|
keyCode = special["<rightCtrlOff>"]
|
||||||
|
original = original[len("<rightCtrlOff>"):]
|
||||||
|
log.Printf("Special code '<rightCtrlOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(original, "<rightShiftOff>") {
|
||||||
|
keyCode = special["<rightShiftOff>"]
|
||||||
|
original = original[len("<rightShiftOff>"):]
|
||||||
|
log.Printf("Special code '<rightShiftOff>' found, replacing with: %s", keyCode)
|
||||||
|
|
||||||
|
c.KeyEvent(keyCode, false)
|
||||||
|
time.Sleep(time.Second / 10)
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(original, "<wait>") {
|
if strings.HasPrefix(original, "<wait>") {
|
||||||
log.Printf("Special code '<wait>' found, sleeping one second")
|
log.Printf("Special code '<wait>' found, sleeping one second")
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
@ -256,10 +256,30 @@ proper key:
|
|||||||
|
|
||||||
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
||||||
|
|
||||||
|
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
||||||
|
|
||||||
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
||||||
sending any additional keys. This is useful if you have to generally wait
|
sending any additional keys. This is useful if you have to generally wait
|
||||||
for the UI to update before typing more.
|
for the UI to update before typing more.
|
||||||
|
|
||||||
|
When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `<leftCtrlOn>c<leftCtrlOff>`.
|
||||||
|
|
||||||
In addition to the special keys, each command to type is treated as a
|
In addition to the special keys, each command to type is treated as a
|
||||||
[configuration template](/docs/templates/configuration-templates.html). The
|
[configuration template](/docs/templates/configuration-templates.html). The
|
||||||
available variables are:
|
available variables are:
|
||||||
|
@ -354,6 +354,24 @@ by the proper key:
|
|||||||
|
|
||||||
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
||||||
|
|
||||||
|
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
||||||
|
|
||||||
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
||||||
sending any additional keys. This is useful if you have to generally wait
|
sending any additional keys. This is useful if you have to generally wait
|
||||||
for the UI to update before typing more.
|
for the UI to update before typing more.
|
||||||
@ -361,6 +379,8 @@ by the proper key:
|
|||||||
- `<waitXX> ` - Add user defined time.Duration pause before sending any
|
- `<waitXX> ` - Add user defined time.Duration pause before sending any
|
||||||
additional keys. For example `<wait10m>` or `<wait1m20s>`
|
additional keys. For example `<wait10m>` or `<wait1m20s>`
|
||||||
|
|
||||||
|
When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `<leftCtrlOn>c<leftCtrlOff>`.
|
||||||
|
|
||||||
In addition to the special keys, each command to type is treated as a
|
In addition to the special keys, each command to type is treated as a
|
||||||
[configuration template](/docs/templates/configuration-templates.html). The
|
[configuration template](/docs/templates/configuration-templates.html). The
|
||||||
available variables are:
|
available variables are:
|
||||||
|
@ -290,10 +290,30 @@ by the proper key:
|
|||||||
|
|
||||||
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
||||||
|
|
||||||
|
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
||||||
|
|
||||||
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
||||||
sending any additional keys. This is useful if you have to generally wait
|
sending any additional keys. This is useful if you have to generally wait
|
||||||
for the UI to update before typing more.
|
for the UI to update before typing more.
|
||||||
|
|
||||||
|
When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `<leftCtrlOn>c<leftCtrlOff>`.
|
||||||
|
|
||||||
In addition to the special keys, each command to type is treated as a
|
In addition to the special keys, each command to type is treated as a
|
||||||
[configuration template](/docs/templates/configuration-templates.html). The
|
[configuration template](/docs/templates/configuration-templates.html). The
|
||||||
available variables are:
|
available variables are:
|
||||||
|
@ -314,10 +314,30 @@ by the proper key:
|
|||||||
|
|
||||||
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
- `<pageUp>` `<pageDown>` - Simulates pressing the page up and page down keys.
|
||||||
|
|
||||||
|
- `<leftAlt>` `<rightAlt>` - Simulates pressing the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrl>` `<rightCtrl>` - Simulates pressing the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShift>` `<rightShift>` - Simulates pressing the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||||
|
|
||||||
|
- `<leftAltOff>` `<rightAltOff>` - Simulates releasing a held alt key.
|
||||||
|
|
||||||
|
- `<leftCtrlOff>` `<rightCtrlOff>` - Simulates releasing a held ctrl key.
|
||||||
|
|
||||||
|
- `<leftShiftOff>` `<rightShiftOff>` - Simulates releasing a held shift key.
|
||||||
|
|
||||||
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
- `<wait>` `<wait5>` `<wait10>` - Adds a 1, 5 or 10 second pause before
|
||||||
sending any additional keys. This is useful if you have to generally wait
|
sending any additional keys. This is useful if you have to generally wait
|
||||||
for the UI to update before typing more.
|
for the UI to update before typing more.
|
||||||
|
|
||||||
|
When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them, otherwise they will be held down until the machine reboots. Use lowercase characters as well inside modifiers. For example: to simulate ctrl+c use `<leftCtrlOn>c<leftCtrlOff>`.
|
||||||
|
|
||||||
In addition to the special keys, each command to type is treated as a
|
In addition to the special keys, each command to type is treated as a
|
||||||
[configuration template](/docs/templates/configuration-templates.html). The
|
[configuration template](/docs/templates/configuration-templates.html). The
|
||||||
available variables are:
|
available variables are:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user