mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +00:00
add SetDelay function code and update other code
This commit is contained in:
parent
1b45c63c16
commit
2eba2fee5d
35
robotgo.go
35
robotgo.go
@ -518,12 +518,6 @@ func MouseToggle(togKey string, args ...interface{}) {
|
||||
C.free(unsafe.Pointer(down))
|
||||
}
|
||||
|
||||
// SetMouseDelay set mouse delay
|
||||
func SetMouseDelay(delay int) {
|
||||
cdelay := C.size_t(delay)
|
||||
C.set_mouse_delay(cdelay)
|
||||
}
|
||||
|
||||
// ScrollMouse scroll the mouse
|
||||
func ScrollMouse(x int, direction string) {
|
||||
cx := C.size_t(x)
|
||||
@ -549,6 +543,12 @@ func Scroll(x, y int, args ...int) {
|
||||
C.scroll(cx, cy, cz)
|
||||
}
|
||||
|
||||
// SetMouseDelay set mouse delay
|
||||
func SetMouseDelay(delay int) {
|
||||
cdelay := C.size_t(delay)
|
||||
C.set_mouse_delay(cdelay)
|
||||
}
|
||||
|
||||
/*
|
||||
__ ___ ___________ ____ .______ ______ ___ .______ _______
|
||||
| |/ / | ____\ \ / / | _ \ / __ \ / \ | _ \ | \
|
||||
@ -717,6 +717,12 @@ func CharCodeAt(s string, n int) rune {
|
||||
return 0
|
||||
}
|
||||
|
||||
// UnicodeType tap uint32 unicode
|
||||
func UnicodeType(str uint32) {
|
||||
cstr := C.uint(str)
|
||||
C.unicodeType(cstr)
|
||||
}
|
||||
|
||||
func toUC(text string) []string {
|
||||
var uc []string
|
||||
|
||||
@ -779,12 +785,6 @@ func TypeStr(str string, args ...float64) {
|
||||
}
|
||||
}
|
||||
|
||||
// UnicodeType tap uint32 unicode
|
||||
func UnicodeType(str uint32) {
|
||||
cstr := C.uint(str)
|
||||
C.unicodeType(cstr)
|
||||
}
|
||||
|
||||
// PasteStr paste a string, support UTF-8
|
||||
func PasteStr(str string) string {
|
||||
clipboard.WriteAll(str)
|
||||
@ -829,6 +829,17 @@ func SetKeyboardDelay(delay int) {
|
||||
SetKeyDelay(delay)
|
||||
}
|
||||
|
||||
// SetDelay set the key and mouse delay
|
||||
func SetDelay(d ...int) {
|
||||
v := 10
|
||||
if len(d) > 0 {
|
||||
v = d[0]
|
||||
}
|
||||
|
||||
SetMouseDelay(v)
|
||||
SetKeyDelay(v)
|
||||
}
|
||||
|
||||
/*
|
||||
.______ __ .___________..___ ___. ___ .______
|
||||
| _ \ | | | || \/ | / \ | _ \
|
||||
|
Loading…
Reference in New Issue
Block a user