Jump to content



Photo

Script loop set times.

loop script help

  • Please log in to reply
2 replies to this topic

#1 Scriptmaster

Scriptmaster

    Wayfarer

  • Active Members
  • Pip
  • 56 posts

Posted 23 March 2012 - 07:48 PM

Hey
I have posted before about looping scripts and exit loops but now it is something different.
Take into consideration I am a beginner so do not get angry if you think my ways are 'stupid'

OK I have a script where the user inputs some numbers
before (stupidly) I have tried
(FAILED!!!!!!!!!!!!!!)
$input = inputbox("input", "how many times to repeat?", "") $set = "1" while 1 $set = $set +1 if $set = $input then exitloop else   ;do stuff endif wend


this is an example

$number = inputbox("Beep", "how many times should it repeat?", "") ;repeat $number of times        beep(500, 500) wend


please if you could help.

Edited by Scriptmaster, 23 March 2012 - 07:49 PM.

shutdown(1)







#2 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 23 March 2012 - 07:52 PM

Try this:

$number = inputbox("Beep", "how many times should it repeat?", "") While $number ;repeat $number of times     beep(500, 500)     $number -= 1 wend


OR
$number = inputbox("Beep", "how many times should it repeat?", "") For $I = 1 to  $number ;repeat $number of times     beep(500, 500) Next

Edited by BrewManNH, 23 March 2012 - 07:53 PM.

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#3 Scriptmaster

Scriptmaster

    Wayfarer

  • Active Members
  • Pip
  • 56 posts

Posted 23 March 2012 - 08:03 PM

Try this:

$number = inputbox("Beep", "how many times should it repeat?", "") While $number ;repeat $number of times     beep(500, 500)     $number -= 1 wend


OR
$number = inputbox("Beep", "how many times should it repeat?", "") For $I = 1 to  $number ;repeat $number of times     beep(500, 500) Next

I have seen that used before but did not think it was that simple,
thought it would include
while $input to ;something

but great thanks
shutdown(1)





Also tagged with one or more of these keywords: loop, script, help

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users