Congratulations WBS00001, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Reading Through An Rss File To Get Specific Data

Assistance Requested

Help dbeard with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

dbeard claims to have checked these sources:

Do you mean the code? Via email?


Dj. There are 3 files. 1 is the script. the 2 other files must be placed in the directory public documents and folder test on the c drive.

This script runs with the older version of Ezbuilder but not the new. Something with either FileWrite or HTTPGet might be affecting it.

Run this on a pc with the older version and then try on a pc with the newer version.

Please let me know if you need more info.


And any suggestions for script improvement would be appreciated. Grin


I see what happened - i'll post an update today for you


Use the latest EZ-Builder and your code will work without needing to strip any characters. I modified your EZ-Script a little...



$VZFile ="C:\temp\test.txt"


$todaydate=($year + "-" + $month + "-" + $day)


$url1 = ""; + $todaydate + "&end_date=" + $todaydate + "&api_key=3jMUBZIcgvFXVAMouSZqlWnbjg5N1sPmgsHiEyCD"

if (FileExists($VZFile))
FileDelete($VZFile) #Clears the file and prevents adding to it needlessly


$endOfFile = FileReadEnd($VZFile)


$line = FileReadLine($VZFile)

$field1 = Indexof($line,"name:")
$field2 = Indexof($line,"absolute_magnitude_h: ")
$field3 = IndexOf($line,"feet:")
$field4 = indexof($line,"is_potentially_hazardous_asteroid: ")
$field5 = indexof($line,"close_approach_date:")
$field6 = Indexof($line,"miles_per_hour:")
$field7 = indexof($line," miss_distance:")

if ($field1 > -1)
$field1a = Length($line)
$name = (substring($line,$field1+5,$field1a-7))

if ($field2 > -1)
$field2a = Length($line)
$mag = (substring($line,$field2+22,$field2a-24))

if ($field3 > -1)
$line = FileReadLine($VZFile)
$field3a = IndexOf($line,"estimated_diameter_min: ")

$line = FileReadLine($VZFile)
$field3b = IndexOf($line,"estimated_diameter_max: ")


if ($field4 > -1)
$haz = substring($line,$field4+35,3)

if ($field5 > -1)
$field5a = indexof($line," ,")
$closedate = substring($line,$field5+20,$field5a-21)


if ($field6 > -1)

$MPH = substring($line,$field6+15,7)


if ($field7 > -1)
$line = FileReadLine($VZFile)
$line = FileReadLine($VZFile)
$line = FileReadLine($VZFile)
$line = FileReadLine($VZFile)
$field7a = Length($line)
$miles = (substring($line,7,$field7a-8))
$ready = 1
$field7 = -1

# print($name)
# print($mag)
# print($diamin)
# print($diamax)
# print($haz)
# print($Closedate)
# print($MPH)
# print($miles)
# sleep(3000)

if ($ready = 1 )

if ($ahaz[$arraycounter] = "fal")
$hazard = $hazard
$hazard = $hazard + 1



$endOfFile = FileReadEnd($VZFile)



repeatuntil($sortcounter = $arraycounter)

if ($amiles[$thenumber]< $amiles[$sortcounter+1])


if ($hazard = 0)
$hazardstatement =(" None of these encounters are rated as potentially hazardous.")
$hazardstatement = ("with " + $hazard + " rated as potentially hazardou.")

saywait(" There are " + $arraycounter + " Near Earth Asteroid Fly buys " + $hazardstatement)

if ($arrayCounter > 0)
saywait(" The asteroid designated" + $aname[$thenumber] + " will safely pass by earth at a distance of " + round($amiles[$thenumber]) + " Miles.")
saywait("It is estimated to be between " + round($adiamin[$thenumber]) + " feet and " + round($adiamax[$thenumber])+ " feet in diameter and, is traveling At a speed of " + (round($aMPH[$thenumber])) + " MPH.")


DJ. Did you actually get the script to work? I downloaded and installed the latest version of EzBuilder. Used your script and it downloads and writes the file, but cant find any info for today and I know there is. Am I doing something wrong?


Ok, I see. I need to reparse through the data to find my values. Much work. I have probably 5 others I need to redo. I did get this one working though. Thanks.


I'm a bit late to this party. Yea! the left paren issue has been resolved! Unfortunately there are other things commonly found in the strings which make up a web page which will cause problems and crashes so filtering will still be needed in other cases. For example quote marks, or LF and CR in cases in which the user wishes to take in the entire web page contents at once into a single variable.

If you look at the output file you will see that the search terms like name: and Absolute_magnitude_h: are now (without filtering) name : and absolute_magnitude_h : with a space before the colon which the filter program must have previously taken out. So you would need to change those search words, as well as the others, to include the space for it to work properly. That's why they are not being found currently.

EDIT: Ah, I see dbeard, you have found the problem while I was checking things out and creating this reply.


WBS00001, are there other things your program was clearing out that is going to cause a problem? With the update your Scrub program no longer works.

I have got the script working after fixing a lot of the parsing. Smile


In what way is the Scrub program not working?

The Scrub program does some pre-emptive character replacement in addition to the left paren removal. It also deletes double quotes and changes E to e. It gets rid of quotes because strings in the Scripts are bounded by them. So any in a string read from a web page will cause a crash or truncated string. This isn't a bug though, just a fact of life. Lower casing E prevents the problem when an uppercase E is followed directly by a number. The script interpreter will try to treat it as an E-notation value and crash in so doing. Also a backslash can sometimes cause problems so they are removed, as well as the semi-colon.

As your project currently stands it seems to be free from any of those problems, given the web page you are using.

I have a new version of the scrub program which is more versatile than what you are currently using should you be interested. It is used pretty much like you are using what you have now. Switching to it would not be too difficult. If you post your project to the cloud I could download it and modify it to use the new stuff, then upload it back.