var WshShell = WScript.CreateObject( "WScript.Shell" ); counter = 0; do { rnd = Math.floor( 3 * Math.random( ) + 1 ); switch ( rnd ) { case 1: WshShell.SendKeys( "{CAPSLOCK}" ); case 2: WshShell.SendKeys( "{SCROLLLOCK}" ); default: WshShell.SendKeys( "{NUMLOCK}" ); } WScript.Sleep( 100 ); counter = counter + 1; } while ( counter < 150 );