求按键精灵脚本求高手帮写个脚本

2025-04-17 10:19:58
推荐回答(2个)
回答1:

LS的说做不到就太绝对了,老师说所有的困难只有想不到,没有做不到。。:P


虽然按键精灵没有提供相关的功能,但我们可以通过Windows的系统API:GetAsyncKeyState。实现这个功能,代码如下,完美好用!


Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer

While 1

    a = GetAsyncKeyState(65)
    s = GetAsyncKeyState(83)
    d = GetAsyncKeyState(68)
    w = GetAsyncKeyState(87)

    If a < 0 Then 
        MoveTo 541, 639
        LeftDown 1
    ElseIf s < 0 Then
        MoveTo 595, 689
        LeftDown 1
    ElseIf d < 0 Then
        MoveTo 650, 639
        LeftDown 1
    ElseIf w < 0 Then
        MoveTo 594, 578
        LeftDown 1
    ElseIf a = 1 or s = 1 or d = 1 or w = 1 Then
        LeftUp 1
    End If

    Delay 300
    '此处为扫描频率,按需求自由调整

Wend


希望我的回答对你有帮助

^o^

回答2:

这个做不到,按键精灵没有办法检测按键弹起。