Newbie question about session variable
Hi,
First, thanks for what looks like a pretty amazing tool. I'm trying to get through
the "Hello World!" tutorial and have most of it working, but my script is failing the run test. Here's the script, which I think I copied correctly:
session.log( "Writing data to a file." );
// Create a FileWriter object that we'll use to write out the text.
out = new FileWriter( "form_submitted_text.txt" );
// Write out the text.
out.write( session.getVariable( "FORM_SUBMITTED_TEXT" ) );
// Close the file.
out.close();
When I run this, I get a dialog with a Script Error that reads:
"Attempt to invoke method: log() on undefined variable or class name: session : at Line: 3."
[BTW, this dialog won't let me copy to the clipboard, which is kind of annoying]
I think this must be something simple, since when I hook the script up to the scraper
itself and run it, the script works and generates the file with the correct contents - the only time I get the failure is when I use the Run button on the script page itself.
I'm running the basic edition 3.0 on a Mac with MacOS 10.4.
Thanks much,
Ken
4.0
You'll probably want to consider upgrading to basic edition 4.0 from our site. However, there is a change that is going to effect you:
As of version 4.0, there is no longer a run button on scripts. They can still be invoked easily enough through other scripts or through the scrapable files themselves.
Depending on what you're trying to do, this may or may not be a problem. Here in our office for screen-scraper, we do all of our projects for clients without such functionality. You may want to keep 3.0 and 4.0 as seperate installations, though, so that nothing irreversable happens to your exported data :) If your project(s) are big enough, I'd definitely export your scrape(s) from screen-scraper before making the switch.
If you run into strange errors when you try to import into 4.0, send us a support email to [email protected] with the exported session attached and we'll fix it for you really quick and send it back.
Tim