Can someone clean this up for me please? Messy syntax

Hey all, I'm using this script and although to me it makes sense, the beanshell formatting says otherwise haha. If anyone could just re-write this script so that it works, that would be amazing!

if ( session.getVariable( "PAGENUMBER" ) = 11 ) {
session.setVariable( "PAGENUMBER", 0 );
session.scrapeFile( "Main Directory 2" );
} else {
session.addToVariable( "PAGENUMBER", 1 );
session.scrapeFile( "Main Directory 2" );
}

Can someone clean this up for me please? Messy syntax

Vilarin,

Ah! I've made this mistake before, too. A single "=" is used for assigning a value but what you want to do is evaluate the variable. In this case, use "==" in your first line.

Try that. See if it works.

-Scott