All good suggestions. However, 'Sleep 300' will cause a sleep of 300 seconds, not 300 milliseconds. Use sleep 0.3 if you want 300 milliseconds.