Need help to close a loop based on count

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Provalian
Newbie
Posts: 7
Joined: Mon Jan 23, 2006 3:41 pm
Location: Roanoke VA

Need help to close a loop based on count

Post by Provalian » Thu Feb 02, 2006 8:45 pm

Another newbie question. The below script performs exactly as I want it to with the exception of ending the loop. Can someone review this and spot my error? On line 155 I start a message to return the count. It is always 1 even though it just processed a record > 1. I seem to be loosing the count before the Until statement. Thanx

\IFWindowOpen>Proval *
GoTo>start1
Else
EndIf
Wait>3
Run Program>C:\Program Files\Manatron\ProValPlus\proval.exe
WaitWindowOpen>ProVal *
Press Shift
Press Tab
Release Shift
Send Character/Text>DwayneH
Wait>1
Press tab
Send Character/Text>3333
Wait>1
Press Enter
Wait>5
Label>start1
SetFocus>ProVal *
//*******Begin Loops******************
Let>numloops=0
Label>loop
Let>numloops=numloops+1
Let>count=0
Let>max=7
Repeat>count
Let>count=count+1
Wait>1
GoTo>APPR_PRC
EndIf
//********End Loop*************************
//********Appraiser Section****************
Label>APPR_PRC
Wait>1
Month>Month
Year>Year
Let>Appr1=Sales_AL
Let>Appr2=Sales_CW
Let>Appr3=Sales_KC
Let>Appr4=Sales_RS
Let>Appr5=Sales_SB
Let>Appr6=Sales_SS
Let>Appr7=Sales_TC
Let>Setid1=%Date%%Appr1%
Let>Setid2=%Date%%Appr2%
Let>Setid3=%Date%%Appr3%
Let>Setid4=%Date%%Appr4%
Let>Setid5=%Date%%Appr5%
Let>Setid6=%Date%%Appr6%
Let>Setid7=%Date%%Appr7%
Press Alt
Release Alt
SendCharacterText>FO
Wait>1
Press Enter
Wait>1
MouseOver>Parcel Selection,Query
Wait>1
LClick
Wait>1
Press Tab
Press Home
Press Shift
Press End
Release Shift
Wait>1
If>numloops=1
Send>%Appr1%
Press Down
EndIf
If>numloops=2
Send>%Appr2%
Press Down
EndIf
If>numloops=3
Send>%Appr3%
Press Down
EndIf
If>numloops=4
Send>%Appr4%
Press Down
EndIf
If>numloops=5
Send>%Appr5%
Press Down
EndIf
If>numloops=6
Send>%Appr6%
Press Down
EndIf
If>numloops=7
Send>%Appr7%
Press Down
EndIf
Wait>1
Press Enter
WaitWindowOpen>ProVal *
WaitReady>0
Wait>1
IFWindowOpen>Read image list
SetFocus>Read image list
Press Enter
Wait>1
EndIf
SetFocus>ProVal *
GoTo>SavePSet
//*************Save Parcelset***********************
Label>SavePSet
SetFocus>ProVal *
Wait>3
Press ALT
Send Character/Text>fa
Release ALT
Wait>1
Month>Month
Year>Year
Wait>1
Let>Date=%Month%%Year%
\\MessageModal>%Date%
Let>PSet1=%Setid1%
Let>PSet2=%Setid2%
Let>PSet3=%Setid3%
Let>PSet4=%Setid4%
Let>PSet5=%Setid5%
Let>PSet6=%Setid6%
Let>PSet7=%Setid7%
Wait>1
Press Home
Press Shift
Press End
Release Shift
If>numloops=1
Send>%PSet1%
Endif
If>numloops=2
Send>%PSet2%
EndIf
If>numloops=3
Send>%PSet3%
EndIf
If>numloops=4
Send>%PSet4%
EndIf
If>numloops=5
Send>%PSet5%
EndIf
If>numloops=6
Send>%PSet6%
EndIf
If>numloops=7
Send>%PSet7%
EndIf
Wait>1
Press Enter
Message>Count is %Count%
Wait>3
Press Enter
SetFocus>ProVal *
Wait>1
Let>WW_TIMEOUT=5
WaitWindowClosed>Save Parcel Set
If>WW_RESULT=FALSE,Endit
..
..
Label>Endit
EndIf
Goto>loop
Until>count=max
EndIf
Label>End

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

Post by JRL » Thu Feb 02, 2006 10:38 pm

Line 167 "Goto>loop" resets your counter every time through. Your variable "count" will never equal "max" because you keep resetting it to zero.

If you really want to repeat the process, "goto>loop" should come after "until>count=max". However, it looks to me like you don't want the "goto>loop" at all. If you use it your script will repeat forever.

Hope this is helpful,
Dick

Provalian
Newbie
Posts: 7
Joined: Mon Jan 23, 2006 3:41 pm
Location: Roanoke VA

Post by Provalian » Fri Feb 03, 2006 12:31 pm

Thanks for your reply. I do want the script to loop as I need it to process 7 times. The Appraiser Section section finds a set of records based on the name. The Save Parcelset saves the set of records with a specific name. There are 7 sets to be processed. I may be on the wrong track to achieve this.

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