session.breakpoint() passing values back to ss

When session.breakpoint() is called, is there a way for the script that called it to find out whether the user choose to stop or continue scraping the script? I'd like to have the script display some additional state information before it ends if the user selected 'stop' but to go on if not.

I was thinking I could use the session.isRunning() function, but it doesn't really seem to work.

I think what your seeing is

I think what your seeing is caused by a loop in a script. You tell the scrape to stop, and the loop doesn't end right then, and fills your log with "stopping scrape" messages; am I right?

In that case, you can build a little logic using that method into your loop:

while(session.getVariable("CONTINUE"))
{
session.addToVariable("PAGE", 1);
session.log("Starting page " + session.getVariable("PAGE"));
session.scrapeFile("Next page");

if (!session.isRunning())
{
break;
}
}

Something like that should work.

theburningor, If you're

theburningor,

If you're looking for a more graceful way to have screen-scraper stop when asked to you could try...


while(session.getVariable("CONTINUE") && !session.shouldStopScraping())
{
session.addToVariable("PAGE", 1);
session.log("Starting page " + session.getVariable("PAGE"));
session.scrapeFile("Next page");
}

-Scott