Event Handler and Loops
Could SS use an event handler within a loop for when a user clicks stop scrape? This would assist in stopping the scrape immediately within the loop without waiting for it to complete. I believe there may be something like this on here.
If I find some time this weekend I'll certainly write a java library that may be able to mimic what I'm looking for.
Event Handler and Loops
Awesome! Thank you so much! I'll give it a whirl.
As well I've learned a lot from the scrapbook scraping files, perhaps a sticky to them on the forum for other people getting a handle on SS who consumed the tutorials?
Event Handler and Loops
While your testing it's been helpful to simply pare down large data files to prevent runaway loops if you need to manually stop a session.
Event Handler and Loops
Hi,
Something sort of like that happens currently, only there's no guarantee as to when the script will stop. screen-scraper uses a library called the Bean Scripting Framework to handle executing scripts. Within that library there's a method to tell the script to stop, wherever it might be in its execution flow. That's a bit of a black box as far as screen-scraper is concerned, but it generally does stop fairly quickly. I've noticed as well, though, that it doesn't often seem to stop loops very quickly.
Regarding an event handling mechanism, in order for that to work there would need to be a call made from within the script in order to check for that condition. It's not documented, but you can actually do that now by calling:
session.shouldStopScraping()
If the session received any kind of notice indicating that the session needs to stop (e.g., the user clicked the "Stop Scraping" button), that method will return true. If you wanted to call that method within your loop you could handle breaking out of it yourself.
Todd