求一个vbs随机数脚本

来源:百度知道 编辑:UC知道 时间:2024/05/27 14:45:31
用vbs产生12位英文与数字混合的随机数,运行后延时2秒并输出到当前光标所在位置,不要弹出提示框之类的,谢谢各位高手帮一个小忙

' test.VBS

char = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Redim num(len(char)-1)
for x=0 to len(char)-1
num(x)=right(left(char, x+1), 1)
next

Randomize
for x=1 to 12
str = str & num(Int(len(char) * Rnd))
next

WScript.Sleep 2000
set wshshell = CreateObject("WScript.Shell")
wshshell.SendKeys str

输出到当前光标所在位置好象不行吧?
' test.VBS

char = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Redim num(len(char)-1)
for x=0 to len(char)-1
num(x)=right(left(char, x+1), 1)
next

Randomize
for x=1 to 12
str = str & num(Int(len(char) * Rnd))
next

WScript.Sleep 2000
set wshshell = CreateObject("WScript.Shell")
wshshell.SendKeys str