Only one number instead of a number from 0 to 2 several times

Good, so I'm going to make a neat program that launched your Number Lock, Caps Lock, and Scroll Lock. My problem is when I run it, it only generates one number, not a few different ones, any ideas as to what might be the problem?

Set Keys = WScript.CreateObject("WScript.Shell") 'So The Script Can Press keys Dim MAX, MIN 'Declaration MAX = 2 'Sets MAX Equal To 2 MIN = 0 'Sets MIN Equal To 0 Randomize 'So The Numbers Are Different All The Time Number = (Int((MAX-MIN+1)*Rnd+MIN)) 'Assigns The Random number To A Variable Do Until X = 10 'Does The Loop 10 Times Select Case Number Case 0 'If Number = 0 Then The Following happens WScript.Sleep 500 'Stops The Script For 500 Milliseconds Keys.SendKeys("{NUMLOCK}") 'Pushes The Number Lock Case 1 'If Number = 1Then The Following happens WScript.Sleep 500 'Stops The Script For 500 Milliseconds Keys.SendKeys("{CAPSLOCK}") 'Pushes The Caps Lock Case 2 'If Number = 2 Then The Following happens WScript.Sleep 500 'Stops The Script For 500 Milliseconds Keys.SendKeys("{SCROLLLOCK}") 'Pushes The Scroll Lock End Select X = X + 1 'Increment Loop 
0
source share
2 answers

Posting a comment as an answer ...

Well, for starters, you might want to put your equation in a loop so that it restores a random number after each loop.

+5
source

You need to create a random number in in a loop:

 Do Until X = 10 'Does The Loop 10 Times Number = (Int((MAX-MIN+1)*Rnd+MIN)) 'Assigns The Random number To A Variable Select Case Number 
-1
source

All Articles