4 Replies Latest reply on Nov 19, 2015 4:43 AM by ngarad RSS
    sabarish Apprentice


    Hi I am trying to use this Code inside Thingworx JavaScript service.
    I am getting syntax error on highlighted portion.
    Appreciate your help in this.

     <title>Application Executer</title>  
      <HTA:APPLICATION ID="oMyApp"        
      APPLICATIONNAME="Application Executer"       
       BORDER="no"        CAPTION="no"      
        SHOWINTASKBAR="yes"        SINGLEINSTANCE="yes"        S
        YSMENU="yes"        SCROLL="no"        WINDOWSTATE="normal">   
        <script type="text/javascript" language="javascript">       
        function RunFile()

        WshShell = new ActiveXObject("WScript.Shell")

    <b>    var Exe = "D:/FileBridge.exe";</b>

    <b>    var JobId = "67";</b>

        WshShell.Run(Exe + " " + JobId, 1, false)

       <input type="button" value="Run Subthermal" onclick="RunFile();"/></body></html>

      • Execution
        paic Collaborator

        Are you trying to execute a file Server side or Client side?

        And what is the use case for this?

        • Execution
          sabarish Apprentice

          I am trying to execute a file Server side.
          We have a nested .exe file which we tried to execute from SQL Server Stored Procedure. It looks like only the outer executable is being executed and not the inner one (this is a fortran .exe).
          So we tried to do it this way.


          • Execution
            vladimirros Creator

            Hi Sabarish,

            1. The code that you displayed on your answer contains HTML elements. In a ThingWorx service you can only put Javascript code.
            2. The ActiveXObject is only available in an IE Browser...not in a server side code.
            3. If you must run an executable, server side, my first choice would be an Extension to ThingWorx that'll wrap the call to that exe file. That Extension will have a service with a parameter like JobID in your case.

            Hope it helps!



            • Re: Execution
              ngarad Newbie

              Hi Sabarish,


              I am having the same requirement. Are you able to do this from thingworx and how?