update PasteStr function code return error

This commit is contained in:
vcaesar 2020-02-18 12:27:21 -04:00
parent 079dcfc995
commit 550fc6a80b

View File

@ -785,6 +785,16 @@ func UnicodeType(str uint32) {
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
// TypeStr(string: The string to send), Wno-deprecated
func TypeString(str string) {
@ -795,16 +805,6 @@ func TypeString(str string) {
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
func TypeStrDelay(str string, delay int) {
TypeStr(str)