Launch a *.exe file from codesys

giancavio
2015-04-14
2024-04-19
  • giancavio - 2015-04-14

    Hi,
    I know that is possible launch a *.exe file from a button propriety in the codesys HMI, using the propiety "execute command". Is it possible do it also directly from ST code?

    Thank you

     
  • MHU - 2015-04-14

    Hi,

    You could try ```

    Sys ExecuteCommand( 'yourExe.exe' )

    ```
    (without the blank after Sys, somehow, the forum does not allow to write it without blank, otherwise it creates just a: _)

    from the SysOS23 library if your PLC supports this.

    Best Regards

     
  • eschwellinger

    eschwellinger - 2015-04-14

    Hi,
    yes but is depends on which Version you are using and additional which OS
    your plc is running on.

    BR
    Edwin

     
  • giancavio - 2015-04-16

    Hi,
    I include library SysOS23 in my project and I try to do it:

    _('C:\Programmi\Notepad++\notepad++.exe');

    but the notepad++.exe do not start.

    In attachment my versions.

    VersionInfo.txt [18.37 KiB]

     
  • loraul - 2015-04-16

    Hi,
    try this:

    VAR
          sEditor         : STRING:='D:\Software\Notepad++\notepad++.exe';
       
          pResult        : DWORD;
          udiResult     : UDINT;
    END_VAR
    udiResult:=SysProcessCreate2(sEditor,i_sFilePath,SYSPROCESS_CREATEFLAG_INTERACTIVE,pResult);
    

    You shoud add the SysProcess library.

     
  • Hang - 2015-04-29

    Hi, loraul, I have tried your code and add the SysProcess library.

    PROGRAM PLC_PRG
    VAR
       sEditor         : STRING:='C:\Program Files\XnView\xnview.exe';
       
       pResult        : DWORD;
       udiResult     : UDINT;
       pszCommand      :STRING:='C:\Program Files\XnView\xnview.exe';
       i_sFilePath: STRING;
    END_VAR
    udiResult:=SysProcessCreate2(sEditor,i_sFilePath,SYSPROCESS_CREATEFLAG_INTERACTIVE,pResult);
    

    but the execution "XnView" doesn´t response

     
  • kumareasu - 2024-04-18

    Have you solved this ?

     

Log in to post a comment.