按键精灵 使用随机数洗牌程序写完运行不了求指导
Dim a,b,c,x,y,ar,br,cr,xr,yr
a=Array("0,0","224,0","336,0","448,0" ,"560,0","112,0","224,92","336,92","0,92","448,92","560,92","112,92" ,"0,184","112,184","224,184","336,184","448,184","560,184")
b=洗牌("1234567891011")
For q=1 to 15 // 改选取数量
c=a(int(b(q))-1)
x=Split(c, ",")(0)
y=Split(c, ",")(1)
TracePrint x & "," & y
RestoreMousePos
Delay 100
MoveR x, y
Delay 200
LeftClick 1
Delay 200
Next
目的是18个坐标里面随机选12个坐标 展开
//随机数0-9以内可以用下面这个方法,要不然用洗牌的方法。
Randomize
Do
Do
W = Int((4 * Rnd) + 1) TracePrint W If InStr(字符串, CStr(W)) = 0 Then 字符串 = 字符串 & CStr(W)
TracePrint "字符串 = " & 字符串
Exit Do
ElseIf len(字符串) > 3 The 字符串 = ""TracePrint "新一轮开始"
End If
Loop
Delay 200
TracePrint"-------------" & W
// If W = 1 Then
// Call 子程序1
// Delay 999
// ElseIf W = 2 Then
// Call 子程序2
// Delay 999
// ElseIf W = 3 Then
// Call 子程序3
// Delay 999
// ElseIf W = 4 Then
// Call 子程序4
// Delay 999
// End Ifloop
2024-09-19 广告
用abcdr代替我懂了 b=洗牌("qwertyuiopasdfghjk") 但是这个相应的按键码减去值没弄懂拜托回复下
返回值 = 洗牌("abcdcdefg")
a=Array("0,0","224,0","336,0","448,0" ,"560,0","112,0","224,92","336,92","0,92","448,92","560,92","112,92" ,"0,184","112,184","224,184","336,184","448,184","560,184")
MessageBox a(Asc(返回值(1))-96)
//你想随机选取18个坐标就把上面返回值的括号数字改为1至18
Function 洗牌(字符串内容)
//说明:可以打乱一句内容顺序
//例子:MsgBox lib.算法.洗牌("123啊456")
Dim 结果,数量,i, j, temp
数量=Len(字符串内容)
ReDim tt(数量)
结果 = ""
For i = 1 To 数量
tt(i) = Mid(字符串内容,i,1)
Next
Randomize
For j = 1 To 数量
i = Int(数量 * Rnd + 1)
temp=tt(i)
tt(i)=tt(j)
tt(j)=temp
Next
// 洗牌 = Join(tt,"")//这句把TT数组合起来,修改为不合起,如下
洗牌 = tt
End Function