Version 1.1.5 user upgrading to 2.0
I have been using version 1.1.5 for a while and my script stopped working so I decided to install the basic version 2.0. I have everything up an running and imported all of my scripts. I am having a problem with a vbscript that basically takes my extracted data and writes it to an XML file. I used the old Slash Dot example that created a text file to adapt it to writing an XML file. This is the error message I receive in the scraping session log.
Processing scripts after scraping session has ended.
Processing script: "USGS--VBSCRIPT"
USGS: An error occurred while processing the script: USGS--VBSCRIPT
USGS: The error message was: Scripting engine failure
Microsoft VBScript runtime error: 15:1
Object required: 'DataSet'
(scode=0x800a01a8wcode=0x0)
Scraping session finished.
I have verified my MSVM is 3810. I am running on Windows 2003 Web Edition as was Screen-Scraper 1.1.5. Below is my script file. Sorry for posting the lengthy thread.
' Generate objects to write data to a file.
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objUsgsFile = objFSO.CreateTextFile( "c:\inetpub\wwwroot\rivertrac\usgs.xml" )
' Create XML
objUsgsFile.Write "" + vbCrLf
objUsgsFile.Write "" + vbCrLf
objUsgsFile.Write "
' Iterate through all of the data records found in the data set.
For i = 0 to DataSet.GetNumDataRecords - 1
site = dataSet.get( i, "Site_ID" )
stage = dataSet.get( i, "Level" )
select case site
case "01584050"
min = "2.8"
max = "6.0"
name = "Long Green Creek"
location = "Glen Arm, MD."
case "01459500"
min = "2.4"
max = "7.0"
name = "Tohickon Creek"
location = "Near Pipersville"
case "01536500"
min = "3.0"
max = "6.0"
name = "Susquehanna River"
location = "Wilkes-Barre"
case "01570500"
min = "3.8"
max = "4.8"
name = "Susquehanna River"
location = "Harrisburg"
case "01575500"
min = "3.5"
max = "7.0"
name = "Codorus Creek"
location = "York"
case "01581920"
min = "2.0"
max = "5.0"
name = "Upper Gunpowder"
location = "Below Pretty Boy Dam"
case "01582000"
min = "3.0"
max = "4.0"
name = "Little Falls"
location = "Blue Mount Balt. County"
case "01646500"
min = "2.8"
max = "8.0"
name = "Potomac River"
location = "Little Falls"
case "03069500"
min = "3.0"
max = "7.0"
name = "Cheat Narrows"
location = "Parsons"
case "03070260"
min = "1.5"
max = "5.0"
name = "Cheat Canyon"
location = "Albright Conversion"
stage = ( stage * 1.55 ) + .5
stage = Round( stage, 2 )
case "03075500"
min = "2.8"
max = "4.0"
name = "Top Yough"
location = "Near Oakland, MD"
case "03076500"
min = "2.8"
max = "4.0"
name = "Upper Yough"
location = "Sang Run Conversion"
'stage = ( stage ) - 1.25
case "03081500"
min = "1.6"
max = "9.0"
name = "Lower Yough"
location = "Ohiopyle"
case "03185400"
min = "-1.0"
max = "7.3"
name = "New River Gorge"
location = "Fayette Station Conversion"
stage = (stage * 1.33) - 4.66
stage = Round( stage, 2 )
case "03189600"
min = "6.0"
max = "15.0"
name = "Upper Gauley"
location = "Below Summersville Dam"
end select
objUsgsFile.Write vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write stage
objUsgsFile.Write "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "" + vbCrLf
objUsgsFile.Write vbTab + "
objUsgsFile.Write vbCrLf
If site = "01570500" Then
min = "6.0"
max = "16.0"
name = "Susquehanna River"
location = "Holtwood"
objUsgsFile.Write vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write stage
objUsgsFile.Write "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "
objUsgsFile.Write vbTab + vbTab + "" + vbCrLf
objUsgsFile.Write vbTab + "
objUsgsFile.Write vbCrLf
end if
Next
objUsgsFile.Write "" + vbCrLf
' Close the file.
objUsgsFile.Close
Thanks
Thanks Todd! I was not envoking the script from the extraction pattern tab. All is working again.
Version 1.1.5 user upgrading to 2.0
Hi Walt,
Thanks for the posting. The error message you're getting indicates that the script is being invoked when the DataSet isn't in scope. We actually have a FAQ on this here
http//www.screen-scraper.com/support/faq/faq.php#ScopeScriptError
If that doesn't seem to help please feel free to post a reply.
Kind regards,
Todd Wilson
[email protected]