用按键精灵 输入100到140之间的随机整数数值 代码怎么写? 谢谢
范围1x = 307范围1y = 333范围1x1 = 427范围1y1 = 496范围2x = 444范围2y = 333范围2x1 = 561范围2y1 = 500范围3x = 578范围3y = 333
范围3x1 = 696范围3y1 = 500范围4x = 715范围4y = 333范围4x1 =832 范围4y1 = 500Do GetCursorPos x, y If x >
范围1x and x < 范围1x1 and y > 范围1y and y < 范围1y1 Then LeftClick 1 Randomize a = Int(2 * Rnd + 4) SayString a KeyPress "Enter", 1 ElseIf x >
范围2x and x < 范围2x1 and y > 范围2y and y < 范围2y1 Then LeftClick 1 Randomize a1 = Int(4 * Rnd + 7) SayString a1 KeyPress "Enter", 1 ElseIf x > 范围
3x and x < 范围3x1 and y > 范围3y and y < 范围3y1 Then LeftClick 1 Randomize a1 = Int(4 * Rnd + 12) SayString a1 KeyPress "Enter", 1 ElseIf x > 范围
4x and x < 范围4x1 and y > 范围4y and y < 范围4y1 Then LeftClick 1 Randomize a1 = Int(6 * Rnd + 25) SayString a1 KeyPress "Enter", 1 End If Delay 100Loop
扩展资料:
随机代码:
Dim Y(9),Z(9)
Val = InputBox("用|分隔","请输入10个字或词","你好|再见|老头|郁闷|努力|神马|纠结|Seven|Eight|Nine",7000,7000)
X = Split(Val, "|")
i=0
Rem 随机数
If i=10
Goto 输出
End If
randomize(timer)
n=int(10*rnd)
If n=10
Goto 随机数
End If
j=0
Rem 随机排序
If j=i
Z(j)=n
i=i+1
Goto 随机数
Else
If Z(j)=n
Goto 随机数
Else
j=j+1
Goto 随机排序
End If
End If
Rem 输出
i=0
For 10
Y(i)=X(Z(i))
i=i+1
Next
Call RunApp("notepad.exe")
Delay 1000
Hwnd = Plugin.Window.Find(0, "无标题 - 记事本")
Hwnd = Plugin.Window.FindEx(Hwnd, 0, "Edit", 0)
i=0
For 10
Call Plugin.Window.SendString(hwnd,Y(i))
Call Plugin.Bkgnd.KeyPress(hwnd,13)
i=i+1
Next
x=int(Rnd()*40+100)
SayString x
真给力 在请教个问题
x = Int((6* Rnd) + 1) 是1到6
为啥 100到140 不是 x = Int((140* Rnd) + 100)了呢?
小白一个 虚心请教 我可能不懂公式的含义
其实我的表达式写错了……
应该是
Randomize
x=int(Rnd()*41+100)
SayString x
int(Rnd()*x+y)
Int((x* Rnd) + y)
都是一样的,生成y到x+y-1的随机整数