mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-04 16:03:54 +00:00
add micro sleep time
This commit is contained in:
parent
fda0ba08a3
commit
1b6fc08b8a
13
robotgo.go
13
robotgo.go
@ -706,15 +706,20 @@ func toUc(text string) []string {
|
|||||||
return uc
|
return uc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func inputUtf(str string) {
|
||||||
|
cstr := C.CString(str)
|
||||||
|
C.input_utf(cstr)
|
||||||
|
|
||||||
|
defer C.free(unsafe.Pointer(cstr))
|
||||||
|
}
|
||||||
|
|
||||||
// TypeStr type string, support UTF-8
|
// TypeStr type string, support UTF-8
|
||||||
func TypeStr(str string) {
|
func TypeStr(str string) {
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
strUc := toUc(str)
|
strUc := toUc(str)
|
||||||
for i := 0; i < len(strUc); i++ {
|
for i := 0; i < len(strUc); i++ {
|
||||||
cstr := C.CString(strUc[i])
|
inputUtf(strUc[i])
|
||||||
C.input_utf(cstr)
|
MicroSleep(7)
|
||||||
|
|
||||||
defer C.free(unsafe.Pointer(cstr))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for i := 0; i < len([]rune(str)); i++ {
|
for i := 0; i < len([]rune(str)); i++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user