mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-03 23:53:54 +00:00
Update TypeStr function, add type
delay and speed support
This commit is contained in:
parent
f449b485a0
commit
c9767fb59b
13
robotgo.go
13
robotgo.go
@ -720,12 +720,16 @@ func inputUTF(str string) {
|
|||||||
|
|
||||||
// TypeStr send a string, support UTF-8
|
// TypeStr send a string, support UTF-8
|
||||||
//
|
//
|
||||||
// robotgo.TypeStr(string: The string to send, float64: microsleep time)
|
// robotgo.TypeStr(string: The string to send, float64: microsleep time, x11)
|
||||||
func TypeStr(str string, args ...float64) {
|
func TypeStr(str string, args ...float64) {
|
||||||
var tm = 7.0
|
var tm, tm1 = 0.0, 7.0
|
||||||
|
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
tm = args[0]
|
tm = args[0]
|
||||||
}
|
}
|
||||||
|
if len(args) > 1 {
|
||||||
|
tm1 = args[1]
|
||||||
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
strUc := toUC(str)
|
strUc := toUC(str)
|
||||||
@ -736,10 +740,11 @@ func TypeStr(str string, args ...float64) {
|
|||||||
UnicodeType(ustr)
|
UnicodeType(ustr)
|
||||||
} else {
|
} else {
|
||||||
inputUTF(strUc[i])
|
inputUTF(strUc[i])
|
||||||
MicroSleep(tm)
|
MicroSleep(tm1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MicroSleep(tm)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +753,7 @@ func TypeStr(str string, args ...float64) {
|
|||||||
UnicodeType(ustr)
|
UnicodeType(ustr)
|
||||||
|
|
||||||
// if len(args) > 0 {
|
// if len(args) > 0 {
|
||||||
// MicroSleep(tm)
|
MicroSleep(tm)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user