
PRO
dbeard
USA
Asked

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
Dbeard: ARC beta v2020.03.17.00 fixes the Blockly issue with getVoltage and adds new File commands: https://synthiam.com/Products/Releases/ARC-Beta-2020-03-17-00-19052
Also, here's some code similar to PTP's but it deletes the file and reads from it...
PTP: EZ-Script won't be removed, as it'll continue to support legacy programs. We'll probably see it phase out over time. But it has always had weird bugs with reading files because of the way it handled quotes and other stuff. Future development on ezscript is super low on priority
One more issue I am trying to play audio via a soundboard which is added to my project and it says there are no sound boards.
Any thoughts. I have followed the Blockly tutorial on playing sound and when I use the pull down list I don't see my sound board either.
Soundboard EZB or Soundboard PC? Only soundboard EZB are supported for "Play Audio" command. You want to use the Utility -> ControlCommand for the soundboard PC
DJ. Thanks. I think I have everything I need, except one item. In JavaScript I see the file. options. But nothing about writing a file. I see the ability to append, but not write a new file. Or am I missing it.
Sometimes I almost lose hope... did you read my post ? I took time to open the ARC, test the code and post a valid example.
Please check post #7
I've used File.appendString it creates a new file or appends to an existing one.
If you don't want to append you can do a File.Delete before doing a File.appendString.
To be honest, It's not your fault is mine.
Ok, yes. I was looking through the comments and missed your comment because it hides the top most and only shows the recent. Started at #8 as the first visible post. So sorry, didn't even realize that had happened until I saw your post and was looking for #7.
Thanks.
[quote][/quote]I am able to read and write the data file. But now I need to search through it and find a string.
I am using var linein = File.readLine(dataFile);
var n = dow.search(linein); (this is line 20 the error is referencing.)
but receive the following error:
Execution Error Line 20 Col 2 - Line 1: Invalid regular expression
another bit of help?
a working example:
the above code downloads Synthiam's front page questions and parses que questions links using a indexOf.
The method search uses regular expressions.
help with JS: https://www.w3schools.com/jsref/jsref_indexof.asp
@DJ: I believe there are some bugs with File class exported to Jint.
*** code edited ***