Menu

Is there a way to execute external program/script from worker script ?

2021-01-29
2021-02-02
  • Sylvain Basset

    Sylvain Basset - 2021-01-29

    Hi,

    I have a question about external link to other executable:
    I already use a worker script in js. But Indeed, I have a very specific need, which consists to decode incoming data from CAN and translate them into strings, according to rules stored in an XML file.

    So I need to open and parse an Xml file.

    I'm pretty OK to do that in python, but not in javascript :).

    So I wondering if there is a possibility to execute python script, exe file (with paramterers, and getting standard output), or even dll from a worker script ??

     
  • Stefan Zieker

    Stefan Zieker - 2021-02-01

    Hi,

    it's really easy to parse an XML file from a worker script. You can find an example in exampleScripts\WorkerScripts\TestXml (all XML related functions are described in the manual).

    If you want to create an external process you can use createProcessDetatched, createProcess or createProcessAsynchronous (these functions are described in the manual). You can find an example in exampleScripts\WorkerScripts\TestProcess.

     
  • Stefan Zieker

    Stefan Zieker - 2021-02-01

    I forgot to mention that you can load a dll from a worker script too (loadLibrary). You can find an example in exampleScripts\WorkerScripts\LoadLibrary.

     

    Last edit: Stefan Zieker 2021-02-01
  • Anonymous

    Anonymous - 2021-02-01

    Hi Stefan,

    Thanks for your response.
    Indeed all my needs about XML are in your API, and we can import a DLL.
    Double RTFM for me :), my bad.

    You've done a great job anyway.

     
  • Stefan Zieker

    Stefan Zieker - 2021-02-02

    thx :-)

     

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.