按键精灵吧 关注:500,487贴子:1,031,084
  • 13回复贴,共1

求大神来指点

只看楼主收藏回复

Do
x = WaitKey()
If x = 32 Then
变量="1,2,3,4,5,6,7,8,9,10,11,12"
Randomize
最小 = 1
最大 = len(变量)
返回值=mid(变量,Int((最大 - 最小 + 1) * Rnd + 最小),1)
TracePrint 返回值
If 返回值 = 1 Then
KeyPress "J", 1
End If
If 返回值 = 2 Then
KeyPress "K", 1
End If
If 返回值 = 3 Then
KeyPress "l", 1
End If
If 返回值 = 4 Then
KeyPress "u", 1
End If
If 返回值 = 5 Then
KeyPress "i", 1
End If
If 返回值 = 6 Then
KeyPress "o", 1
End If
If 返回值 = 7 Then
KeyDown 16, 1
KeyPress 74, 1
KeyUp 16, 1
End If
If 返回值 = 8 Then
KeyDown 16, 1
KeyPress 75, 1
KeyUp 16, 1
End If
If 返回值 = 9 Then
KeyDown 16, 1
KeyPress 76, 1
KeyUp 16, 1
End If
If 返回值 = 10 Then
KeyDown 16, 1
KeyPress 85, 1
KeyUp 16, 1
End If
If 返回值 = 11 Then
KeyDown 16, 1
KeyPress 73, 1
KeyUp 16, 1
End If
If 返回值 = 12 Then
KeyDown 16, 1
KeyPress 79, 1
KeyUp 16, 1
End If
End If
Loop
以上是代码
但是操作的时候就出现了问题
有时候就是成功!
有时候就不匹配!
求解

图上显示数字就是成功了
有时候就类型不匹配
大神指点江山
求解
这是个键盘随机组合的


IP属地:四川1楼2019-02-19 01:30回复
    返回值中会有“,”和数字在比较,当然出错


    IP属地:浙江来自手机贴吧2楼2019-02-19 02:52
    收起回复
      2025-12-25 23:53:27
      广告
      不感兴趣
      开通SVIP免广告
      微信公众:青春电影电视。这里面有个大佬给写软件


      IP属地:山西4楼2019-02-19 11:17
      回复
        Randomize
        Do
        x = WaitKEY()
        If x = 32 Then
        按键码 = int(rnd * 12) + 65
        If 按键码 < 71 Then
        'TracePrint chr(按键码)
        KeyPress 按键码, 1
        Else
        'TracePrint chr(88) & "+" & chr(按键码 - 6)
        KeyDown 按键码 - 6, 1
        KeyPress 88, 1
        Keyup 按键码 - 6, 1
        End If
        End If
        Delay 100
        Loop


        IP属地:浙江5楼2019-02-19 12:56
        收起回复


          IP属地:四川6楼2019-02-22 03:47
          收起回复