Asked
Resolved Resolved by ptp!

Filereadline Getting Error Data Is In Wrong Format

I have created a file by downloading data from the web.

this is the line of code

FileWrite($DataFile,HTTPGet($url1))

Where $DataFile is the file location on my harddrive and url1 is the where the data is on the web.

The data gets successfully wrote to the hard drive.

Now my next line of code is $line = FileReadLine($DataFile).

The first line of the Data file is:  <!DOCTYPE html>

This fails with the error Input string was not in a correct format.

Now this used to work but with ARC this fails.

What format should the Datafile be in for this to continue?


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

PRO
Synthiam
#1  

If you're parsing data, i'd recommend using the javascript. The EZ-Script is quite terrible at parsing strings. While nothing has changed in the ezscript compiler, i imagine the webpage you're querying may have some changes that is breaking the parser. EZ-Script is not my favorite haha. Javascript is just so much more powerful (and 1000 times faster)

#2  

My goodness, I gotta learn Javascript. Do you have any recommendations on educational literature I can read that would give me a good idea of how to learn it?

PRO
Synthiam
#3  

Dave, it's so similar to ezscript... but easier i think.

The commands are all categorized in their own sections. For example, all File commands start with File. And all servo commands start with Servo. When you type the category, the drop down will display all commands in that category.

So you can move your robot by typing...


Movement.forward();

or you can create a variable like


var x = "some text";

print(x);

or you can make reusable functions like


function MyFunction(var x) {

 x = x + 1;

 return  x;
}

print(MyFunction(5));

Or you can get super crazy...


var thisIsFun = Movement.forward();

thisIsFun;

IF conditions have open and closing braces...


var x = 3;

if (x == 3) {

  print("it matches");

} else {

  print("No match");
}

But... how ever you decide to learn javascript, the Blockly in ARC generates javascript. So you can just use Blockly and look at the JavaScript code it generates...

#4  

Sweet. Thanks. I'll be looking closer at all this soon.

United Kingdom
#5  

DJ I get the impression that ez-script wouldn’t be supported for much long and removed??

Does that mean all my ez-scripts projects will have to be converted to JavaScripts?

PRO
USA
#6  

Question.  I don't know JavaScript.  But attempting something easy in JavaScript.

This code is the code in Blockly

User-inserted image

It returns an error object has no method.

Can you get me past this hurdle.  Also any suggestions on a book or website to help me learn java script.

PRO
USA
#7  
FileWrite($DataFile,HTTPGet($url1))

JS equivalent:

File.appendString(dataFile, Net.hTTPGet(url1));

test version:

var url1 = "https://synthiam.com/Community/Questions";;
var dataFile = "c:\\temp\\questions.html";

var html = Net.hTTPGet(url1);
File.appendString(dataFile, html);
PRO
USA
#8  

Quote:

DJ I get the impression that EZ-Script wouldn’t be supported for much long and removed??

Does that mean all my ez-scripts projects will have to be converted to JavaScripts?

@DJ maybe a conversion tool EZ-Script to Javascript.