Problem with loop

Hi,

I am trying to loop through a scrape to stop the problems with recursive with the stack. But for some reason the loop starts and then a new loop starts and a new loop starts but none go through the loop numbers until I cancel the scrape and then all the loops go through but do not so what they are mean't to. I have shorted it. Any help would be appreciated

for(int i = 1; i < 9; i++)
{
litreIteration = i;

if ( litreIteration == 1) { litre="00"; session.log("in the litre 00"); }
else if ( litreIteration == 2) { litre="10"; }
else if ( litreIteration == 3) { litre="11"; }
else if ( litreIteration == 4) { litre="12"; }
else if ( litreIteration == 5) { litre="13"; }
else if ( litreIteration == 6) { litre="14"; }
else if ( litreIteration == 7) { litre="15"; }
else if ( litreIteration == 8)
{
int modelNum = session.getVariable("MODEL_NUM");
modelNum = modelNum + 1;
session.setVariable("MODEL_NUM", modelNum);

String model = "";

if(modelNum == 1) { model = "AC"; }
else if(modelNum == 2) { model = "AIXAM"; }
else if(modelNum == 3) { model = "ALFA ROMEO"; }
else if(modelNum == 4) { model = "ANT"; }
else if(modelNum == 5) { model = "ASIA"; }
else if(modelNum == 6) { model = "ASTON MARTIN"; }
else if(modelNum == 7) { model = "AUDI"; }
else
{
session.stopScraping();
}

litreIteration = 2;
session.setVariable("VEHICLE_MAKE", model);

//now set the litre so that it can be done after the if else statement
litre = "00";

}

session.setVariable("VEHICLE_LITRE", litre);

session.log("Vehicle litre is: " + session.getVariable("VEHICLE_LITRE"));

session.scrapeFile("Copy of find car model");

}

I think I would need to see

I think I would need to see the whole session to see how this script is being called, but I suspect that you're launching the script from within itself and it's creating an infinite loop.