Identical code giving errors...

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

Identical code giving errors...

Post by IanSmith » Fri Aug 04, 2006 9:10 am

Hi all, I have to say I'm scoobied with this one. I've revisited some code from a year ago, and two identical loops are giving very different results...

Loop one is this:

let>clear1=1
repeat>clear1
let>extcount[%clear1%]=0
let>size[%clear1%]=0
add>clear1,1
writeln>c:\datacheck\progress.txt,null,Clear1 is %clear1%
until>clear1,20

which, as expected, gives this:

Clear1 is 2
Clear1 is 3
Clear1 is 4
Clear1 is 5
Clear1 is 6
Clear1 is 7
Clear1 is 8
Clear1 is 9
Clear1 is 10
Clear1 is 11
Clear1 is 12
Clear1 is 13
Clear1 is 14
Clear1 is 15
Clear1 is 16
Clear1 is 17
Clear1 is 18
Clear1 is 19
Clear1 is 20

loop2 is a cut and paste code in a different subroutine:

let>clear2=1
repeat>clear2
let>extcount[%clear2%]=0
let>size[%clear2%]=0
add>clear2,1
writeln>progress.txt,result4,clear2 is %clear2%
until>clear2,20

which gives this:

clear2 is 0
clear2 is 0
clear2 is 0
clear2 is 0

ad infinitum...

also, I had problems with a variable setting to 0.

any comments/suggestions/howls of derision would be appreciated.

Thanks, Ian

Running 7.4.005 pro on XP

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 04, 2006 9:23 am

My bet is that somewhere in your script prior to loop 2 you have inadvertantly created a variable called 1 which has been set to 0. Before the loop add MessageModal>1 and see what it displays. If I'm right step through with the watch list open and look closely at all places you have used a numeric 1 - one of those maybe meant to be a return var and as such 1 has become 0.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

Post by IanSmith » Fri Aug 04, 2006 12:05 pm

Eye thangoo. I'm out of the office till Monday, but I'll give that a shot.

Take care, Ian

IanSmith
Junior Coder
Posts: 24
Joined: Tue Jul 12, 2005 2:31 pm

Post by IanSmith » Mon Aug 07, 2006 9:44 am

Hi Marcus,

You were right - I had placed a 1 as a return var for a writeln...I'll be slapping myself later.

Many thanks, Ian

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