@@ -569,7 +569,7 @@ func MouseClick(args ...interface{}) {
569569// robotgo.Click(button string, double bool)
570570//
571571// Examples:
572- // robotgo.Click() // default is left button
572+ // robotgo.Click() // default is left button
573573// robotgo.Click("right")
574574// robotgo.Click("wheelLeft")
575575func Click (args ... interface {}) {
@@ -680,6 +680,40 @@ func Scroll(x, y int, args ...int) {
680680 MilliSleep (MouseSleep )
681681}
682682
683+ // ScrollSmooth scroll the mouse smooth,
684+ // default scroll 5 times and sleep 100 millisecond
685+ //
686+ // robotgo.ScrollSmooth(toy, num, sleep, tox)
687+ //
688+ // Examples:
689+ // robotgo.ScrollSmooth(-10)
690+ // robotgo.ScrollSmooth(-10, 6, 200, -10)
691+ func ScrollSmooth (to int , args ... int ) {
692+ i := 0
693+ num := 5
694+ if len (args ) > 0 {
695+ num = args [0 ]
696+ }
697+ tm := 100
698+ if len (args ) > 1 {
699+ tm = args [1 ]
700+ }
701+ tox := 0
702+ if len (args ) > 2 {
703+ tox = args [2 ]
704+ }
705+
706+ for {
707+ Scroll (tox , to )
708+ MilliSleep (tm )
709+ i ++
710+ if i == num {
711+ break
712+ }
713+ }
714+ MilliSleep (MouseSleep )
715+ }
716+
683717// ScrollRelative scroll mouse with relative
684718//
685719// Examples:
@@ -711,12 +745,12 @@ func SetMouseDelay(delay int) {
711745// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
712746//
713747// Examples:
714- // robotgo.KeySleep = 100 // 100 millisecond
748+ // robotgo.KeySleep = 100 // 100 millisecond
715749// robotgo.KeyTap("a")
716- // robotgo.KeyTap("i", "alt", "command")
750+ // robotgo.KeyTap("i", "alt", "command")
717751//
718- // arr := []string{"alt", "command"}
719- // robotgo.KeyTap("i", arr)
752+ // arr := []string{"alt", "command"}
753+ // robotgo.KeyTap("i", arr)
720754//
721755func KeyTap (tapKey string , args ... interface {}) string {
722756 var (
@@ -812,10 +846,10 @@ func KeyTap(tapKey string, args ...interface{}) string {
812846// https://github.com/go-vgo/robotgo/blob/master/docs/keys.md
813847//
814848// Examples:
815- // robotgo.KeyToggle("a")
816- // robotgo.KeyToggle("a", "up")
849+ // robotgo.KeyToggle("a")
850+ // robotgo.KeyToggle("a", "up")
817851//
818- // robotgo.KeyToggle("a", "up", "alt", "cmd")
852+ // robotgo.KeyToggle("a", "up", "alt", "cmd")
819853//
820854func KeyToggle (key string , args ... string ) string {
821855 if len (args ) <= 0 {
@@ -955,7 +989,7 @@ func inputUTF(str string) {
955989// robotgo.TypeStr(string: The string to send, float64: microsleep time, x11 option)
956990//
957991// Examples:
958- // robotgo.TypeStr("abc@123, hi, こんにちは")
992+ // robotgo.TypeStr("abc@123, hi, こんにちは")
959993//
960994func TypeStr (str string , args ... float64 ) {
961995 var tm , tm1 = 0.0 , 7.0
@@ -1077,6 +1111,11 @@ ____ __ ____ __ .__ __. _______ ______ ____ __ ____
10771111*/
10781112
10791113// ShowAlert show a alert window
1114+ // Displays alert with the attributes.
1115+ // If cancel button is not given, only the default button is displayed
1116+ //
1117+ // Examples:
1118+ // robogo.ShowAlert("hi", "window", "ok", "cancel")
10801119func ShowAlert (title , msg string , args ... string ) bool {
10811120 var (
10821121 // title string
@@ -1235,7 +1274,13 @@ func cgetTitle(hwnd, isHwnd int32) string {
12351274 return gtitle
12361275}
12371276
1238- // GetTitle get the window title
1277+ // GetTitle get the window title return string
1278+ //
1279+ // Examples:
1280+ // fmt.Println(robogo.GetTitle())
1281+ //
1282+ // ids, _ := robogo.FindIds()
1283+ // robogo.GetTitle(ids[0])
12391284func GetTitle (args ... int32 ) string {
12401285 if len (args ) <= 0 {
12411286 title := C .get_main_title ()
@@ -1250,7 +1295,7 @@ func GetTitle(args ...int32) string {
12501295 return internalGetTitle (args [0 ])
12511296}
12521297
1253- // GetPID get the process id
1298+ // GetPID get the process id return int32
12541299func GetPID () int32 {
12551300 pid := C .get_PID ()
12561301 return int32 (pid )
0 commit comments