modifying POST parameter in a loop

how do I repeat the scrape in a loop, modifying the (single) POST parameter each time? Prefer vbscript example...

Do I have to set up a screen-scraper server and call the session in a loop?

modifying POST parameter in a loop

Hi,

Instead of creating a RunnableScrapingSession for each scrape you want to do, I think you'll find it much easier to take the approach we recommend in our tutorial, which is to create a single scraping session, then invoke a scrapeable file multiple times. You can just as easily create a script that will loop through the values in code, rather than reading them in from a file.

As to the error message you're getting, if you download and install the "Shopping Site" example from our third tutorial (here), you'll see an example of invoking a scraping session in VBScript. Hopefully that will help you debug.

Kind regards,

Todd

modifying POST parameter in a loop

I tried to use this example but there is quite a bit different. It would help to have an overview of the process and then some examples. I need to use POST vars, instead of URL vars, don't have to worry about logins, form data is generated by code instead of read from a file, etc.

I think I've determined that I should:
1) create a script that runs my "scrapeable file"
2) move the parameter modifying logic out of the file to the above script

e.g.
Set runnableScrapingSession = CreateBean( "com.screenscraper.scraper.RunnableScrapingSession", "Foo file" )
runnableScrapingSession.SetVariable "srch", Escape( "ab" )
runnableScrapingSession.Scrape

Where "srch" is the POST variable used by the site being scraped, "ab" is the test form data. In the final version, I would put the last two lines of code in a FOR loop, starting with "aa" and ending with "zz", going through the 676 possible combinations.

But when I try it, I get:

Script: Run Foo scrape

Error Message:

Scripting engine failure
Courtesy of Java: method name:createBean: 0:0
Java Exception: class com.ibm.bsf.BSFException

(scode=0x80020009 wcode=0x0)

modifying POST parameter in a loop

Hi,

Would this fit the bill: here?

Kind regards,

Todd Wilson

modifying POST parameter in a loop

I should add that the parameter needs to incremented if a numeric, or alphabetically incremented if text. E.g. "A" on first interation, "B" on next, etc.