VBscript didn't find the object
Hi
I'll try to scrape a page with stock informations.
The data ist extracting (see log) without errors
my problem is, vb. my script do not find the object/variables
I tried it with "session.getVariable" and with "DataRecord.Get( "Stockexchange" )". It doesn't work. The Object ist not in the session
any ideas ?
thx in advance
brother-t
------ SaveData start -----
' Output a message to the log so we know that we'll be writing the text out to a file.
Session.Log "Writing data to a file."
'Session.Log session.getVariable("Stockexchange")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFonds = objFSO.OpenTextFile("d:\Fonds1.txt",8,true)
' Write out the text.
'objFonds.Write session.getVariable("Stockexchange")
objFonds.Write DataRecord.Get( "Stockexchange" ) + vbTab
' Close the file.
objFonds.Close
set objFSO = Nothing
------ SaveData end-----
------ log start -----
Starting scraper.
Running scraping session: Comdi
Processing scripts before scraping session begins.
Scraping file: "Fonds"
Fonds: Processing scripts before a file is scraped.
Fonds: URL is: http://isht.comdirect.de/html/detail/main.html?sSym=DE0009771980.DFK.
Fonds: Scraping file with URL: http://isht.comdirect.de/html/detail/main.html?sSym=DE0009771980.DFK
Fonds: Sending request.
Fonds: Processing scripts before all pattern applications.
Fonds: Extracting data for pattern "Timestamp"
Fonds: The following data elements were found:
Timestamp--DataRecord 0:
Timestamp=13.05.05 14:00 Uhr
Fonds: Processing scripts after a pattern application.
Fonds: Processing scripts after all pattern applications.
Skipping the following script because it's disabled: "SaveData"
Fonds: Extracting data for pattern "Price_Buy"
Fonds: The following data elements were found:
Price_Buy--DataRecord 0:
Price_Buy=41,17
Fonds: Extracting data for pattern "Time"
Fonds: The pattern did not find any matches.
Fonds: Extracting data for pattern "Date"
Fonds: The following data elements were found:
Date--DataRecord 0:
Date=13.05.05
Fonds: Extracting data for pattern "Stockexchange"
Fonds: The following data elements were found:
Stockexchange--DataRecord 0:
Stockexchange=Ja
Fonds: Extracting data for pattern "MinInvest"
Fonds: The following data elements were found:
MinInvest--DataRecord 0:
MinInvest=1.000 EUR
Fonds: Processing scripts after a file is scraped.
Processing script: "SaveData"
Writing data to a file.
Fonds: An error occurred while processing the script: SaveData
Fonds: The error message was: Scripting engine failure
Laufzeitfehler in Microsoft VBScript: 12:0
Objekt erforderlich: 'DataRecord'
(scode=0x800a01a8 wcode=0x0)
Processing scripts after scraping session has ended.
Scraping session finished.
------ log end -----
VBscript didn't find the object
Hi brother-t,
Thanks for the posting. This is actually just a matter of running your script at the right time, and is addressed in this FAQ http//www.screen-scraper.com/support/faq/faq.php#ScopeScriptError . If you're referencing the 'DataRecord' object you'll want to run the script 'After each pattern application' for the extractor pattern containing the information you want. It looks as though in your case, however, that you have multiple extractor patterns grabbing the data. In this case it will depend on the structure of the data you're extracting (e.g., if it's in multiple rows or simply a series of values in one "row" of data). In the case of a single row you could store them all in session variables then write them out in a script. In the case of multiple rows you'll likely need to write a script to aggregate the data before writing it out.
Hopefully this helps.
Kind regards,
Todd Wilson
[email protected]