mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update PasteStr function code return error
This commit is contained in:
parent
079dcfc995
commit
550fc6a80b
20
robotgo.go
20
robotgo.go
@ -785,6 +785,16 @@ func UnicodeType(str uint32) {
|
|||||||
C.unicodeType(cstr)
|
C.unicodeType(cstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PasteStr paste a string, support UTF-8
|
||||||
|
func PasteStr(str string) string {
|
||||||
|
clipboard.WriteAll(str)
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
return KeyTap("v", "command")
|
||||||
|
}
|
||||||
|
|
||||||
|
return KeyTap("v", "control")
|
||||||
|
}
|
||||||
|
|
||||||
// TypeString send a string, support unicode
|
// TypeString send a string, support unicode
|
||||||
// TypeStr(string: The string to send), Wno-deprecated
|
// TypeStr(string: The string to send), Wno-deprecated
|
||||||
func TypeString(str string) {
|
func TypeString(str string) {
|
||||||
@ -795,16 +805,6 @@ func TypeString(str string) {
|
|||||||
C.free(unsafe.Pointer(cstr))
|
C.free(unsafe.Pointer(cstr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PasteStr paste a string, support UTF-8
|
|
||||||
func PasteStr(str string) {
|
|
||||||
clipboard.WriteAll(str)
|
|
||||||
if runtime.GOOS == "darwin" {
|
|
||||||
KeyTap("v", "command")
|
|
||||||
} else {
|
|
||||||
KeyTap("v", "control")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TypeStrDelay type string delayed
|
// TypeStrDelay type string delayed
|
||||||
func TypeStrDelay(str string, delay int) {
|
func TypeStrDelay(str string, delay int) {
|
||||||
TypeStr(str)
|
TypeStr(str)
|
||||||
|
Loading…
Reference in New Issue
Block a user