mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
Merge pull request #379 from go-vgo/bitmap-pr
Update key sleep and fixed typo
This commit is contained in:
commit
fe1a46368f
10
robotgo.go
10
robotgo.go
@ -137,7 +137,7 @@ func MicroSleep(tm float64) {
|
|||||||
C.microsleep(C.double(tm))
|
C.microsleep(C.double(tm))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GoString teans C.char to string
|
// GoString trans C.char to string
|
||||||
func GoString(char *C.char) string {
|
func GoString(char *C.char) string {
|
||||||
return C.GoString(char)
|
return C.GoString(char)
|
||||||
}
|
}
|
||||||
@ -386,7 +386,6 @@ func CheckMouse(btn string) C.MMMouseButton {
|
|||||||
|
|
||||||
// MoveMouse move the mouse
|
// MoveMouse move the mouse
|
||||||
func MoveMouse(x, y int) {
|
func MoveMouse(x, y int) {
|
||||||
// C.size_t int
|
|
||||||
Move(x, y)
|
Move(x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +462,7 @@ func MoveSmooth(x, y int, args ...interface{}) bool {
|
|||||||
return bool(cbool)
|
return bool(cbool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveArgs move mose relative args
|
// MoveArgs move mouse relative args
|
||||||
func MoveArgs(x, y int) (int, int) {
|
func MoveArgs(x, y int) (int, int) {
|
||||||
mx, my := GetMousePos()
|
mx, my := GetMousePos()
|
||||||
mx = mx + x
|
mx = mx + x
|
||||||
@ -629,6 +628,7 @@ func KeyTap(tapKey string, args ...interface{}) string {
|
|||||||
|
|
||||||
str := C.key_Taps(zkey,
|
str := C.key_Taps(zkey,
|
||||||
(**C.char)(unsafe.Pointer(&ckeyArr[0])), C.int(num), 0)
|
(**C.char)(unsafe.Pointer(&ckeyArr[0])), C.int(num), 0)
|
||||||
|
MilliSleep(KeySleep)
|
||||||
return C.GoString(str)
|
return C.GoString(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,6 +668,7 @@ func KeyTap(tapKey string, args ...interface{}) string {
|
|||||||
str := C.key_Taps(zkey, (**C.char)(unsafe.Pointer(&ckeyArr[0])),
|
str := C.key_Taps(zkey, (**C.char)(unsafe.Pointer(&ckeyArr[0])),
|
||||||
C.int(num), C.int(keyDelay))
|
C.int(num), C.int(keyDelay))
|
||||||
|
|
||||||
|
MilliSleep(KeySleep)
|
||||||
return C.GoString(str)
|
return C.GoString(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,6 +700,7 @@ func KeyToggle(key string, args ...string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
str := C.key_Toggles(ckey, (**C.char)(unsafe.Pointer(&ckeyArr[0])), C.int(num))
|
str := C.key_Toggles(ckey, (**C.char)(unsafe.Pointer(&ckeyArr[0])), C.int(num))
|
||||||
|
MilliSleep(KeySleep)
|
||||||
return C.GoString(str)
|
return C.GoString(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +738,7 @@ func KeyToggle(key string, args ...string) string {
|
|||||||
// KeyPress press key string
|
// KeyPress press key string
|
||||||
func KeyPress(key string) {
|
func KeyPress(key string) {
|
||||||
KeyDown(key)
|
KeyDown(key)
|
||||||
Sleep(15 + rand.Intn(10))
|
Sleep(1 + rand.Intn(3))
|
||||||
KeyUp(key)
|
KeyUp(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user