Repeat script questions

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
nick
Newbie
Posts: 6
Joined: Sun Apr 05, 2009 9:06 pm

Repeat script questions

Post by nick » Mon Apr 06, 2009 1:59 pm

Hey people,

Im trying to make a script that will take a value (number) out of the dialog text box and then assign that value to a variable. I then want to repeat a certain part of the script the number of times that the variable value is eg. 3 times.

for example i have.

Code: Select all

Dialog>test
Edit=msEdit1,72,33,193,Enter number
EndDialog>test

let>reno=test.msEdit1

repeat>re
**Here is all my code**
until>re,%reno%
Am i doing this correctly?
[/code]

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 06, 2009 3:08 pm

Very close. You will find many examples of this posted on the forum though they will probably be embedded in other code and might be hard to recognize. I'd do it like this:

Code: Select all

Dialog>test
Edit=msEdit1,72,33,193,Enter number
EndDialog>test

//Initialize your counter
Let>re=0
repeat>re
//add one to the counter each cycle
add>re,1
**Here is all my code**
//cycle until your counter equals the edit box value
until>re,%test.msEdit1%

ainterne
Junior Coder
Posts: 29
Joined: Tue Jun 05, 2007 4:03 am

Post by ainterne » Tue Apr 07, 2009 8:37 am

Hi, here are two ways you can do it. One with an imput box and one with a dialog box.

Code: Select all


/*  THIS WAY USING INPUT BOX

Let>INPUT_BROWSE=0
Input>result,Enter the value here.
Input>count,How many times do you want to repeat your script?
Let>reno=result
Let>k=0
Repeat>k
Let>k=k+1
Let>finishedResult=%reno%*10
Until>k=%Count%
MessageModal>finishedResult

//OR THIS WAY USING A DIALOG BOX
*/

Dialog>Dialog
   Caption=
   Width=315
   Height=87
   Top=204
   Left=753
   Max=1
   Min=1
   Close=1
   Resize=1
   Edit=msEdit1,96,16,121,
   Label=Enter Value here.,8,16,true
   Button=Submit,224,16,65,25,1
EndDialog>Dialog

Show>Dialog,rez
    Let>ans=DIALOG.MSEDIT1
    Let>answer=100
    Let>k=0
        repeat>k
        Let>k=k+1
        Let>s=%answer%+%ans%
        Let>answer=s
        Message>answer
        Until>k=3
End
Phil.......

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts