From f911550742faa5b34c3e203b1364a0084b386c57 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Mon, 28 Nov 2022 13:40:01 -0800 Subject: [PATCH] Update: Update README.md and godoc --- README.md | 5 ++--- doc.go | 2 +- key.go | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 03f44c4..9223dc8 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,9 @@ xcode-select --install Download the Mingw, then set system environment variables `C:\mingw64\bin` to the Path. [Set environment variables to run GCC from command line](https://www.youtube.com/results?search_query=Set+environment+variables+to+run+GCC+from+command+line). - -``` +` Or the other GCC (But you should compile the "libpng" with yourself when use the bitmap.) -``` +` #### For everything else: diff --git a/doc.go b/doc.go index d668b87..b28cde2 100644 --- a/doc.go +++ b/doc.go @@ -54,7 +54,7 @@ Keys are supported: "f23" "f24" - "cmd" is the "win" key for windows + "cmd" this is the "win" key for windows "lcmd" left command "rcmd" right command // "command" diff --git a/key.go b/key.go index e59e1cf..f0b37a8 100644 --- a/key.go +++ b/key.go @@ -30,6 +30,7 @@ import ( "github.com/vcaesar/tt" ) +// Defining a bunch of constants. const ( // KeyA define key "a" KeyA = "a" @@ -321,6 +322,7 @@ var keyNames = map[string]C.MMKeyCode{ // { NULL: C.K_NOT_A_KEY } } +// It sends a key press and release to the active application func tapKeyCode(code C.MMKeyCode, flags C.MMKeyFlags, pid C.uintptr) { C.toggleKeyCode(code, true, flags, pid) MilliSleep(3) @@ -459,6 +461,7 @@ func ToStrings(fields []interface{}) []string { return res } +// toErr it converts a C string to a Go error func toErr(str *C.char) error { gstr := C.GoString(str) if gstr == "" { @@ -481,6 +484,8 @@ func toErr(str *C.char) error { // // arr := []string{"alt", "command"} // robotgo.KeyTap("i", arr) +// +// robotgo.KeyTap("k", pid int) func KeyTap(key string, args ...interface{}) error { var keyArr []string @@ -525,6 +530,7 @@ func KeyTap(key string, args ...interface{}) error { // robotgo.KeyToggle("a", "up") // // robotgo.KeyToggle("a", "up", "alt", "cmd") +// robotgo.KeyToggle("k", pid int) func KeyToggle(key string, args ...interface{}) error { if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) { @@ -648,6 +654,7 @@ func inputUTF(str string) { // Examples: // // robotgo.TypeStr("abc@123, Hi galaxy, こんにちは") +// robotgo.TypeStr("To be or not to be, this is questions.", pid int) func TypeStr(str string, args ...int) { var tm, tm1 = 0, 7