This is an example of two loops that will loop random times using the random numbers generated. It reports the numbers picked and displays results at the end of execution. This script requires Auto Hotkey.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
#NoEnv SetWorkingDir %A_ScriptDir% CoordMode, Mouse, Window SendMode Input #SingleInstance Force SetTitleMatchMode 2 #WinActivateForce SetControlDelay 1 SetWinDelay 0 SetKeyDelay 5 SetMouseDelay 377 SetBatchLines -1 F7:: Macro1: Loop1Count := 0 Loop2Count := 0 RandomLoop1Num: Random, RandomLoop1Num, 5, 35 RandomLoop2Num: Random, RandomLoop2Num, 5, 35 MsgBox, 64, , (LTrim Random Numbers Picked. Random loops for one %RandomLoop1Num% Random loops for two %RandomLoop2Num% ), 5 Loop1: Loop, %RandomLoop1Num% { EnvAdd, Loop1Count, 1 MsgBox, 64, , (LTrim Loop1 %Loop1Count% Loop1 count. ), 1 If Loop1Count >= %RandomLoop1Num% { Goto, Loop2 } } Loop2: Loop, %RandomLoop2Num% { EnvAdd, Loop2Count, 1 MsgBox, 64, , (LTrim Loop2 %Loop1Count% Loop1 Counts %Loop2Count% Loop 2 Counts ), 1 If Loop2Count >= %RandomLoop2Num% { Goto, BreakRoomChill } } BreakRoomChill: MsgBox, 262192, Results, (LTrim %Loop1Count% Loop1Count %Loop2Count% Loop2Count %RandomLoop1Num% RandomLoop1Num %RandomLoop2Num% RandomLoop2Num ) Break Return |