Scripting error with VBScript even after I downloaded MS SW
I am trying to use screen-scraper and have followed the tutorial throughout. Everything worked fine until using scripts. In running the scraping session, with the attached script, I received this error. I have downloaded the latest Microsoft Scripting software from their website, yet still get the error message. Any ideas? Thanks!!!
Starting scraper.
Running scraping session: My Hello World
Processing scripts before scraping session begins.
Scraping file: "Form Submission"
Form Submission: Preliminary URL: http://www.screen-scraper.com/tutorial/basic_form.php?text_string=Hello+...
Form Submission: Resolved URL: http://www.screen-scraper.com/tutorial/basic_form.php?text_string=Hello+...
Form Submission: Sending request.
Form Submission: Processing scripts before all pattern applications.
Form Submission: Extracting data for pattern "Form Data"
Form Submission: The following data elements were found:
Form Data--DataRecord 0:
FORM_SUBMITTED_TEXT=Hello World
Form Submission: Processing scripts after a pattern application.
Form Submission: Processing scripts after all pattern applications.
Processing script: "Write Extracted Data To Text"
Writing data to a file.
Form Submission: An error occurred while processing the script: Write Extracted Data To Text
Form Submission: The error message was: Scripting engine failure
Microsoft VBScript runtime error: 8:0
Type mismatch: 'objStoriesFile.Write'
(scode=0x800a000d wcode=0x0)
Processing scripts after scraping session has ended.
Scraping session finished.
Here is the VBScript I have in the script titled "Write Extracted Data To Text"
' Output a message to the screen-scraper log so we know that we'll be writing the text out to a file.
Session.Log "Writing data to a file."
' Create a FileWriter object that we'll use to write out the text.
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objStoriesFile = objFSO.CreateTextFile( "form_submitted_text.txt" )
' Write out the text.
objStoriesFile.Write Session.GetVariable( "FORM_SUBMITTED_TEXT" )
' Close the file.
objStoriesFile.Close
Scripting error with VBScript even after I downloaded MS SW
Hi,
Looks like the main issue is that you're using the + operator to concatenate strings, when you should be using the & in VBScript. That is, this:
objDVDFile.Write Session.GetVariable( "MLSNumber" ) + vbTab
should be this:
objDVDFile.Write Session.GetVariable( "MLSNumber" ) & vbTab
Also, on the scraping session you emailed to me, you need to save the extracted value in session variables. To do this for one of the variables, follow these steps:
1. Click on your "Hot Sheet" scrapeable file.
2. Click on the "Extractor Patterns" tab.
3. In the "MLS Number" extractor pattern, double-click the "~@MLSNumber@~" extractor pattern token. That should pop-up a box with the title "Edit Token". If it doesn't, you can also highlight the text "MLSNumber", right-click the selected text, then click "Edit token".
4. Check the box labeled "Save in session variable?"
5. Close the "Edit Token" box.
You'll want to do this for each of your extractor pattern tokens for which you want the extracted data to be saved in a session variable.
Kind regards,
Todd
Scripting error with VBScript even after I downloaded MS SW
Ok, I have created an extractor pattern token for each pattern and checked the 'save in session variable' box. Still getting 'Type Mismatch'
Processing script: "TempoScript"
Hot Sheet: An error occurred while processing the script: TempoScript
Hot Sheet: The error message was: Scripting engine failure
Microsoft VBScript runtime error: 5:0
Type mismatch: 'objDVDFile.Write'
Removing the ,8,True gives me 'Bad file Mode'
Thanks!
Scripting error with VBScript even after I downloaded MS SW
Hi,
The "Save in sesssion variable" check box is in the "Edit token" box. Double-click your "FORM_SUBMITTED_TEXT" extractor pattern token (or right-click it and select "Edit token") to bring that up.
Best,
Todd
Scripting error with VBScript even after I downloaded MS SW
Ok I've been working on this for a while. Returns mismatch error which causes further permission denied errors. If I could locate the '"Save in sesssion variable" box for the "FORM_SUBMITTED_TEXT" extractor pattern token' I would definately check that box.
Thanks
Scripting error with VBScript even after I downloaded MS SW
Hi,
A "Permission denied" error response would most likely occur because the user under which you're running screen-scraper doesn't have write access to the directory where screen-scraper is installed. Could you double-check that? If that doesn't seem to yield fruit, feel free to export (here) and email your scraping session to me and I'd be happy to take a closer look. My email address is my first name at screen-scraper.com.
Kind regards,
Todd
Scripting error with VBScript even after I downloaded MS SW
same problem. After searching the forms and tutorials and entering several different file writing scripts I've found that none of them work correctly. Here is the latest error:
Processing script: "Script"
File from New Proxy Session: An error occurred while processing the script: Script
File from New Proxy Session: The error message was: Scripting engine failure
Microsoft VBScript runtime error: 2:0
Permission denied
and here is the script:
' Generate objects to write data to a file.
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objDVDFile = objFSO.OpenTextFile( "Tempo.txt", 8, True )
' Write out the data to the file.
objDVDFile.Write DataRecord.Get( "MLSNumber" ) + vbTab
objDVDFile.Write DataRecord.Get( "Address" ) + vbTab
objDVDFile.Write DataRecord.Get( "City" ) + vbTab
objDVDFile.Write DataRecord.Get( "Zip" ) + vbTab
objDVDFile.Write DataRecord.Get( "AgentName" ) + vbTab
objDVDFile.Write DataRecord.Get( "EmailAddress" ) + vbTab
objDVDFile.Write vbCrLf
' Close the file and clean up.
objDVDFile.Close
Set objFSO = Nothing
Thanks
Scripting error with VBScript even after I downloaded MS SW
Hi,
It looks like your script is fine. My guess is that you forgot to check the "Save in sesssion variable?" box for the "FORM_SUBMITTED_TEXT" extractor pattern token. Could you double-check that to see if it's causing the problem?
Kind regards,
Todd Wilson