Skip to main content
1-Visitor
February 20, 2015
Question

Execution

  • February 20, 2015
  • 4 replies
  • 1608 views

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.

<html><head>  
 <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()
    { 
h2.

    WshShell = new ActiveXObject("WScript.Shell")

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

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

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

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


    4 replies

    1-Visitor
    February 20, 2015

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

    And what is the use case for this?

    sgobi1-VisitorAuthor
    1-Visitor
    February 20, 2015

    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.



    19-Tanzanite
    February 20, 2015

    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!

    BR,
    Vladimir



    5-Regular Member
    November 19, 2015

    Hi Sabarish,

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