Running Scraping Sessions within Scraping Sessions
Overview
This feature is only available to Professional and Enterprise editions of screen-scraper.
It is possible to run a scraping session within a scraping session that is already running. This is done with the RunnableScrapingSession class. Detailed documentation on methods available for the RunnableScrapingSession class are available in our API documentation. Here's a specific example of how the RunnableScrapingSession might be used in a screen-scraper script:
import com.screenscraper.scraper.*;
// Generate a new RunnableScrapingSession object that will inherit
// from the current scraping session. This object will be used
// to run the scraping session "My Scraping Session"
myRunnableScrapingSession = new RunnableScrapingSession( "My Session", session );
// Because we passed the "session" object to the RunnableScrapingSession
// it will have access to all of the session variables within the
// currently running session. As such, there's no need to explicitly
// set any new session variables. We simply tell it to scrape.<
myRunnableScrapingSession.scrape();
// Once it's done scraping, because it inherited from our currently
// running scraping session, we have access to any session variables
// that were set when the RunnableScrapingSession ran in the context
// of our currently running scraping session. For example, let's
// suppose that when the RunnableScrapingSession ran it set a new
// variable called "MY_VAR". Because of the inheritance, we could
// do something like this to see th new value:<
session.log( "MY_VAR: " + session.getVariable( "MY_VAR" ) );