cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Execution

sgobi
6-Contributor

Execution

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 4
paic
1-Newbie
(To:sgobi)

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

And what is the use case for this?

sgobi
6-Contributor
(To:sgobi)

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.



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



ngarad
5-Regular Member
(To:sgobi)

Hi Sabarish,

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

Top Tags