mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-19 14:23:55 +00:00
Refactoring key example code
This commit is contained in:
parent
dd52f408d9
commit
044ed50e53
@ -17,11 +17,7 @@ import (
|
|||||||
// "go-vgo/robotgo"
|
// "go-vgo/robotgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func key() {
|
func typeStr() {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Control the keyboard
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// importing "Hello World"
|
// importing "Hello World"
|
||||||
robotgo.TypeString("Hello World")
|
robotgo.TypeString("Hello World")
|
||||||
|
|
||||||
@ -37,7 +33,9 @@ func key() {
|
|||||||
robotgo.UnicodeType(ustr)
|
robotgo.UnicodeType(ustr)
|
||||||
|
|
||||||
robotgo.PasteStr(" 粘贴字符串, paste")
|
robotgo.PasteStr(" 粘贴字符串, paste")
|
||||||
|
}
|
||||||
|
|
||||||
|
func keyTap() {
|
||||||
// press "enter"
|
// press "enter"
|
||||||
robotgo.KeyTap("enter")
|
robotgo.KeyTap("enter")
|
||||||
robotgo.KeyTap("a", "control")
|
robotgo.KeyTap("a", "control")
|
||||||
@ -58,12 +56,16 @@ func key() {
|
|||||||
robotgo.KeyTap("m", "command")
|
robotgo.KeyTap("m", "command")
|
||||||
robotgo.KeyTap("f1", "control")
|
robotgo.KeyTap("f1", "control")
|
||||||
robotgo.KeyTap("a", "control")
|
robotgo.KeyTap("a", "control")
|
||||||
|
}
|
||||||
|
|
||||||
|
func keyToggle() {
|
||||||
robotgo.KeyToggle("a", "down")
|
robotgo.KeyToggle("a", "down")
|
||||||
robotgo.KeyToggle("a", "down", "alt")
|
robotgo.KeyToggle("a", "down", "alt")
|
||||||
robotgo.KeyToggle("a", "down", "alt", "command")
|
robotgo.KeyToggle("a", "down", "alt", "command")
|
||||||
robotgo.KeyToggle("enter", "down")
|
robotgo.KeyToggle("enter", "down")
|
||||||
|
}
|
||||||
|
|
||||||
|
func cilp() {
|
||||||
robotgo.TypeString("en")
|
robotgo.TypeString("en")
|
||||||
|
|
||||||
// write string to clipboard
|
// write string to clipboard
|
||||||
@ -75,6 +77,19 @@ func key() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func key() {
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Control the keyboard
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
typeStr()
|
||||||
|
|
||||||
|
keyTap()
|
||||||
|
keyToggle()
|
||||||
|
|
||||||
|
cilp()
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
key()
|
key()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user