Copy codeThe code is as follows:
Set a=WScript.CreateObject(“WScript.Shell”)
a.Run “notepad”
‘open Notepad
do
Randomize
x= Int((40 * Rnd) + 1)
‘generate a random number from 1 to 40 and assign it to X
WScript.Sleep 1000
a.SendKeys x&”,”
“Analog keyboard, output x
N = n + 1 ‘accumulator
If n = 10 then Wscript. Quit ‘push script if accumulator n is 10
loop
‘save as VBS and see the result
a.Run “notepad”
‘open Notepad
do
Randomize
x= Int((40 * Rnd) + 1)
‘generate a random number from 1 to 40 and assign it to X
WScript.Sleep 1000
a.SendKeys x&”,”
“Analog keyboard, output x
N = n + 1 ‘accumulator
If n = 10 then Wscript. Quit ‘push script if accumulator n is 10
loop
‘save as VBS and see the result