addAutoProgressBar
void log.addAutoProgressBar ( String name, String[][] values ) (enterprise edition only)
void log.addAutoProgressBar ( String name, Collection<String> values ) (enterprise edition only)
void log.addAutoProgressBar ( String name, String[][] values, int keyIndex ) (enterprise edition only)
void log.addAutoProgressBar ( String name, DataSet values, String key ) (enterprise edition only)
Description
Creates an automatic progress bar and adds it to the progress bars. These progress bars match their progress to a value from a session variable and a list of values. When web messages are output with the webDebug, webInfo, webWarn, or webError methods, a progress bar will be drawn to give a visual representation of the current progress of the scrape.
Note that when using auto progress bars, it is advised to not use any manually monitored ones, as it can cause conflicts. Anytime an auto progress bar has no session variable set for its monitored key, it deletes itself and all children progress bars (including manual ones). As long as you keep that in mind, it should be safe to use both types together.
Parameters
- name The name of the progress bar, which should match the session variable where the value for updating this bar will be stored
- values The values this progress bar can have, in the order they will be queried. For example, if the session variable can be "1" or "2", the values should also be "1" and "2"
- keyIndex (optional) The index in each inner array of the value that will be set in the session variable. This is only applicable when a 2D array is given. When a 2D array is given but no index is given, 0 is used.
- key (optional) The key in the DataRecords that will be used for the session variable matching name. Used only with the DataSet method option
Return Value
This method returns void.
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
Create an auto progress bar to track the search
String[] letters = new String[26];
for(char c = 'a'; c <= 'z'; c++)
letters[ c - 'a' ] = "" + c;
// Using this approach is more convenient when values will get changed in various scripts
log.addAutoProgressBar("SEARCH_LETTER", letters);
for(int i = 0; i < letters.length; i++)
{
session.setVariable("SEARCH_LETTER", letters[ i ]);
session.scrapeFile("Search");
log.logMonitoredValues("Completed Letter");
}
- Printer-friendly version
- Login or register to post comments