mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-04 16:03:54 +00:00
add ScrollSmooth() support and Update godoc
This commit is contained in:
parent
6daec24027
commit
6fd41b9a7c
49
robotgo.go
49
robotgo.go
@ -680,6 +680,40 @@ func Scroll(x, y int, args ...int) {
|
|||||||
MilliSleep(MouseSleep)
|
MilliSleep(MouseSleep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScrollSmooth scroll the mouse smooth,
|
||||||
|
// default scroll 5 times and sleep 100 millisecond
|
||||||
|
//
|
||||||
|
// robotgo.ScrollSmooth(toy, num, sleep, tox)
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
// robotgo.ScrollSmooth(-10)
|
||||||
|
// robotgo.ScrollSmooth(-10, 6, 200, -10)
|
||||||
|
func ScrollSmooth(to int, args ...int) {
|
||||||
|
i := 0
|
||||||
|
num := 5
|
||||||
|
if len(args) > 0 {
|
||||||
|
num = args[0]
|
||||||
|
}
|
||||||
|
tm := 100
|
||||||
|
if len(args) > 1 {
|
||||||
|
tm = args[1]
|
||||||
|
}
|
||||||
|
tox := 0
|
||||||
|
if len(args) > 2 {
|
||||||
|
tox = args[2]
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
Scroll(tox, to)
|
||||||
|
MilliSleep(tm)
|
||||||
|
i++
|
||||||
|
if i == num {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MilliSleep(MouseSleep)
|
||||||
|
}
|
||||||
|
|
||||||
// ScrollRelative scroll mouse with relative
|
// ScrollRelative scroll mouse with relative
|
||||||
//
|
//
|
||||||
// Examples:
|
// Examples:
|
||||||
@ -1077,6 +1111,11 @@ ____ __ ____ __ .__ __. _______ ______ ____ __ ____
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// ShowAlert show a alert window
|
// ShowAlert show a alert window
|
||||||
|
// Displays alert with the attributes.
|
||||||
|
// If cancel button is not given, only the default button is displayed
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
// robogo.ShowAlert("hi", "window", "ok", "cancel")
|
||||||
func ShowAlert(title, msg string, args ...string) bool {
|
func ShowAlert(title, msg string, args ...string) bool {
|
||||||
var (
|
var (
|
||||||
// title string
|
// title string
|
||||||
@ -1235,7 +1274,13 @@ func cgetTitle(hwnd, isHwnd int32) string {
|
|||||||
return gtitle
|
return gtitle
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTitle get the window title
|
// GetTitle get the window title return string
|
||||||
|
//
|
||||||
|
// Examples:
|
||||||
|
// fmt.Println(robogo.GetTitle())
|
||||||
|
//
|
||||||
|
// ids, _ := robogo.FindIds()
|
||||||
|
// robogo.GetTitle(ids[0])
|
||||||
func GetTitle(args ...int32) string {
|
func GetTitle(args ...int32) string {
|
||||||
if len(args) <= 0 {
|
if len(args) <= 0 {
|
||||||
title := C.get_main_title()
|
title := C.get_main_title()
|
||||||
@ -1250,7 +1295,7 @@ func GetTitle(args ...int32) string {
|
|||||||
return internalGetTitle(args[0])
|
return internalGetTitle(args[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPID get the process id
|
// GetPID get the process id return int32
|
||||||
func GetPID() int32 {
|
func GetPID() int32 {
|
||||||
pid := C.get_PID()
|
pid := C.get_PID()
|
||||||
return int32(pid)
|
return int32(pid)
|
||||||
|
Loading…
Reference in New Issue
Block a user