GO语言Robotgo学习-鼠标操作(3)

MoveMouse,移动鼠标到目标位置

MoveMouse(横向坐标,纵向坐标)

robotgo.MoveMouse(600,400)

MoveMouseSmooth,平滑移动到目标位置,模仿人类操作

MoveMouseSmooth(横向坐标,纵向坐标)

robotgo.MoveMouseSmooth(600,400)
robotgo.MoveMouseSmooth(600,400,1.0,20.0)//后面两个参数文档上看lowspeed, highspeed,与速度相关,是能改变移动速度,但是没搞清究竟是怎么个改变的

MouseClick,鼠标点击事件

MouseClick(哪一个键,是否双击)
MouseClick(“left/center/right”,true/false)

robotgo.MouseClick("left",false)//单击鼠标左键

MoveClick,移动到目标位置,并点击

MoveClick(横向坐标,纵向坐标,”right”,false)

robotgo.MoveClick(600,400,"right",false)

MouseToggle,长按

MouseToggle(“down/up”,”left/center/right”)

robotgo.MouseToggle("down","left")

DragMouse名,拖动鼠标

实例里面与MouseToggle合用,没发现与MoveMouse的区别,使用方法相同

robotgo.MouseToggle("down")
robotgo.DragMouse(600, 400)

GetMousePos,获取鼠标当前位置

fmt.Println(robotgo.GetMousePos())

ScrollMouse,滚动鼠标滚轮

ScrollMouse(滚动大小,向上或向下滚动)
ScrollMouse(10,”up/down”)

robotgo.ScrollMouse(1, "up")
    原文作者:eoser
    原文地址: https://www.jianshu.com/p/f69f4758d6e2
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞