美文网首页Go语言学习
GO语言Robotgo学习-鼠标操作(3)

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

作者: eoser | 来源:发表于2018-08-15 16:45 被阅读242次

    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")
    

    相关文章

      网友评论

        本文标题:GO语言Robotgo学习-鼠标操作(3)

        本文链接:https://www.haomeiwen.com/subject/cgdwbftx.html