Menu

Pause in a script

Anonymous
2017-04-06
2017-04-06
  • Anonymous

    Anonymous - 2017-04-06

    Is there a pause command that can be used in a script just like the option in a cyclic sequence?

     
  • Stefan Zieker

    Stefan Zieker - 2017-04-06

    Hi,

    I do not exactly understand what you mean. Can you explain it to me a lit bit more?

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2017-04-06

    The device i'm trying to use the software with needs a pause after each CR+LF before it can process the next line of input. Without a pause only the first command gets processed, all others that come after are disregarded.

    See screenshot1. I am able to send the command successfully twice because I use a pause in the cyclic sequence script.

    See screenshot2. When i do not use a pause, the device does not know how to interpret the second command and only returns information for the first command.

    Ideally, I have a series of registers I wish to pull off the device. The device must take in each command for a register individually, then be allowed to respond, then it will be able to accept a new command.

    I hope this is clear enough and I am using the tool in the proper way.

     
  • Stefan Zieker

    Stefan Zieker - 2017-04-06

    Hi,

    in the attachment you can find a worker script (must be added in the script window) which sends two commands and waits 1s after each command. If you want to process the received data in the script:
    - use scriptThread.dataReceivedSignal
    - remove scriptThread.stopScript()

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2017-04-06

    Thanks. I think i almost have it.

    This maybe a stupid question. How do you place an carriage return in the script after "Command 1"?

     
  • Stefan Zieker

    Stefan Zieker - 2017-04-06

    "Command 1\r"

     
  • Stefan Zieker

    Stefan Zieker - 2017-04-06

    or with bytes:
    var data = Array(1,2,3,4,13)//carriage return=13
    scriptThread.sendDataArray(data);

     
  • Stefan Zieker

    Stefan Zieker - 2017-04-06

    I see in your post above theat you have to send CR+LF:
    "Command 1\r\n"

    var data = Array(1,2,3,4,13, 10)//carriage return=13; line feed=10
    scriptThread.sendDataArray(data);

     
  • Anonymous

    Anonymous - 2017-04-06

    actually the \r is working great.

    I think I can build my script using the following:

    scriptThread.sendString(">682\r")
    scriptThread.sleepFromScript(1000);
    scriptThread.sendString(">672\r")
    scriptThread.sleepFromScript(1000);
    scriptThread.sendString(">207\r")
    scriptThread.sleepFromScript(1000);

    scriptThread.stopScript();

    What would be the advantage to using the Array?

     
  • Stefan Zieker

    Stefan Zieker - 2017-04-06

    I didn't know which kind of commands/data you wanted to sent. Therefore I wanted to show you that you can send strings and byte arrays.
    Using bytes has no andvantages if you want to send strings.

    Best regards,
    Stefan

     

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.