mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-03 07:33:55 +00:00
Add simplify api Click
This commit is contained in:
parent
6d72748ddb
commit
be5aca4670
1
doc.md
1
doc.md
@ -17,6 +17,7 @@
|
||||
#####[MoveMouse](#MoveMouse)
|
||||
#####[MoveMouseSmooth](#MoveMouseSmooth)
|
||||
#####[MouseClick](#MouseClick)
|
||||
#####[Click](#MouseClick)(Equivalent to MouseClick)
|
||||
#####[MouseToggle](#MouseToggle)
|
||||
#####[DragMouse](#DragMouse)
|
||||
#####[GetMousePos](#GetMousePos)
|
||||
|
24
robotgo.go
24
robotgo.go
@ -221,6 +221,30 @@ func GetMousePos() (int, int) {
|
||||
return x, y
|
||||
}
|
||||
|
||||
//Click Click the Mouse
|
||||
func Click(args ...interface{}) {
|
||||
var button C.MMMouseButton
|
||||
var double C.bool
|
||||
Try(func() {
|
||||
// button = args[0].(C.MMMouseButton)
|
||||
if args[0].(string) == "left" {
|
||||
button = C.LEFT_BUTTON
|
||||
}
|
||||
if args[0].(string) == "center" {
|
||||
button = C.CENTER_BUTTON
|
||||
}
|
||||
if args[0].(string) == "right" {
|
||||
button = C.RIGHT_BUTTON
|
||||
}
|
||||
double = C.bool(args[1].(bool))
|
||||
}, func(e interface{}) {
|
||||
// Println("err:::", e)
|
||||
button = C.LEFT_BUTTON
|
||||
double = false
|
||||
})
|
||||
C.aMouseClick(button, double)
|
||||
}
|
||||
|
||||
//MouseClick Click the Mouse
|
||||
func MouseClick(args ...interface{}) {
|
||||
var button C.MMMouseButton
|
||||
|
Loading…
Reference in New Issue
Block a user