首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将鼠标(而不是MouseMove)传送到ahk?

如何将鼠标(而不是MouseMove)传送到ahk?
EN

Stack Overflow用户
提问于 2022-10-29 17:36:41
回答 1查看 41关注 0票数 0

我正在尝试使用一个名为rustdesk的远程桌面软件来玩游戏,我已经创建了一个脚本,可以将鼠标水平地移动360度,但是一旦鼠标从左到右,游戏中的角色也会移动,所以如何在没有看到沙司桌上的变化的情况下移动MoveMouse。

这是代码:

代码语言:javascript
复制
#Persistent

SetTimer, check, -100
return

check(){
    If edge("left")
    {
        MouseMove, 1718, 490, 0
        
    }
    else if edge("right")
    {
        MouseMove, 0, 490, 0
        
    }

    ; ...

    SetTimer, check, -100
}

edge(pos){
    SysGet, VirtualWidth, 78
    SysGet, VirtualHeight, 79
    T := 10 
    CoordMode, Mouse, Screen
    MouseGetPos, mX, mY
    left := (mX < T)
    top := (mY < T)
    right := (mX > VirtualWidth - T)
    bottom := (mY > VirtualHeight - T)
    If (pos = "left")
        return left
    else if (pos = "top")
        return top
    else if (pos = "right")
        return right
    else if (pos = "bottom")
        return bottom
}
代码语言:javascript
复制
I tried using BlockInput but it completely stops the mouse.
EN

回答 1

Stack Overflow用户

发布于 2022-10-30 15:18:32

要阻止键盘输入,可以尝试

代码语言:javascript
复制
#NoEnv
ListLines Off
SetBatchLines -1
#KeyHistory 0
Process, Priority,, H

#Persistent

SetTimer, check, -100
return

Critical

check(){
    If edge("left")
    {
        BlockKeyboard("On")
        MouseMove, 1718, 490, 0
        BlockKeyboard("Off")
    }
    else if edge("right")
    {
        BlockKeyboard("On")
        MouseMove, 0, 490, 0
        BlockKeyboard("Off") 
    }
    SetTimer, check, -100
}

edge(pos){
    SysGet, VirtualWidth, 78
    SysGet, VirtualHeight, 79
    T := 10 
    CoordMode, Mouse, Screen
    MouseGetPos, mX, mY
    left := (mX < T)
    top := (mY < T)
    right := (mX > VirtualWidth - T)
    bottom := (mY > VirtualHeight - T)
    If (pos = "left")
        return left
    else if (pos = "top")
        return top
    else if (pos = "right")
        return right
    else if (pos = "bottom")
        return bottom
}

BlockKeyboard(state){
    Loop, 512
    {
        Key := Format("SC{:X}",A_Index)
        If (state = "On")
            Hotkey, *%Key%, KeyboardKey, On UseErrorLevel
        else
            Hotkey, *%Key%, KeyboardKey, Off UseErrorLevel
    }
    KeyboardKey:
    return
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74247447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档