getProgressBar

ProgressBar log.getProgressBar ( int index ) (enterprise edition only)
ProgressBar log.getProgressBar ( String title ) (enterprise edition only)

Description

Returns the progress bar specified. If the index if given, returns the progress bar at that index (0 is the root, 1 is the first child, etc...). If the title is given, returns the most recently added progress bar with the given title

Parameters

  • index (optional) The desired ProgressBar's index
  • title (optional) The title to search for

Return Value

The ProgressBar indicated, or null if none was found matching the required criteria

Change Log

Version Description
5.5.29a Available in all editions.
5.5.31a Available in enterprise edition.
5.5.43a Moved from session to log class.

Examples

Track the progress of a search over the alphabet

 import com.screenscraper.util.ProgressBar;

 ProgressBar bar = log.addProgressBar("Letter", 26);
 for(char c = 'a'; c <= 'z'; c++)
 {
   session.setVariable("SEARCH_LETTER", c);
   session.scrapeFile("Search");
   bar.add(1);

   // For Professional and Enterprise Editions
   log.webInfo("Completed Search on: " + c);

   // For Basic Edition ** Note that this method is available in Professional and Enterprise editions also
   log.logMonitoredValues();
 }

 // Now that we have completed the search, remove the progress bar
 log.removeProgressBar(bar);

 // Increment the value of the Category progress bar (created in a separate script).
 // It is generally recommended to save a reference as a session variable rather than using this method
 log.getProgressBar("Category").add(1);