Menu

periodic reading of variable length lines from an ASCII text file and sending as hex-converted binary data

Anonymous
2020-06-16
2020-06-18
  • Anonymous

    Anonymous - 2020-06-16
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2020-06-16

    oops... I didn't mean to double post
    I didn't see the "awaiting oderation" message first time
    please use the second one

     
  • Stefan Zieker

    Stefan Zieker - 2020-06-17

    Hi you can find an example in the attachment that does following:
    - read the text file data.txt (in the script folder)
    - splits the lines (all lines must end with \r\n)
    - removes => and all in front of it for every line
    - converts the remaining hex string to a byte array and sends it line by line
    - after 10s the above sequence is repeated

     

    Last edit: Stefan Zieker 2020-06-17
    • Anonymous

      Anonymous - 2020-06-17

      kewl, thank you
      I dove into the QTscript docs to see if I could figure it out myself
      I found the
      sendFileWithPause.js and then searched for
      scriptFile.readBinaryFile
      thinking that nearby would be references to
      scriptFile.readTextFileOneLine
      or some such thing

      I just ended up down the rabbit hole of full-on OO C++ programming

      Somewhere I saw a reference to a script editor which apparently contains
      all of the function references
      I'm guessing I'd have to install QT ?
      I'm guessing scriptcommunicator is written in QT ?

       
  • Stefan Zieker

    Stefan Zieker - 2020-06-17

    No, you don't have to install Qt (but yes, ScriptCommunicator is written in Qt).
    ScriptCommunicator comes with a ScriptEditor. If you add a script in the script windows and klick the 'edit script menu' then the editor will open with your script.
    If you want to know more about the API function you should have a look in the manual.

     
    • Anonymous

      Anonymous - 2020-06-18

      I did manage to find script edit in
      Scripts | Script | Edit Worker Script

      I also managed to figure out how to insert a wait in there
      so it doesn't send all the lines in one quick braaap

      But Weird!!!
      If I attempt to remove any lines from data.txt,
      it throws "Invalid line format"
      I don't see anything in the script that determines how
      many lines there need to be in the file

      Aah...
      I see that the last line did not have a /r/l
      so the script is gagging on the /r/l with nothing after it.
      In the course of monkeying around editing the data file
      script threw 64:RangeError:Maximum call stack size exceeded...
      can't stop it... I went to "Close all windows" and at first it appeared
      to do nothing, then after a while it stopped the script but left
      both the main and scripts windows open...

      Well, getting my wheels on

       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.