开发者

Return values from exe in javascript

i have to call an executable in the client machine in asp.net and get the return parameters, i been looking for an example but i couldn't find it.

it this possible to recover the output paramet开发者_C百科ers from one exe in JavaScript?

i know that can i write:

var WshShell = new ActiveXObject("WScript.Shell"); var oExec = WshShell.Exec("My.exe");

but the clients executable returns 0 or 1 that values are the ones i need to collect

Thanks in advance


Browser-based JavaScript can't call executable files on client machines; to do so would be a catastrophic security problem. If you have to run an executable on the client machine, consider asking the user to install a .NET application, an ActiveX control, or something like Java if you want to be platform-independent.

Depending on what you're trying to do, you may not need to run an EXE on the client machine; you can do a LOT with standard cloud-type scenarios (JS or SilverLight on the client, Web services or WCF on the server). Without more information about your situation, however, it's impossible to tell.

EDIT: Based on your comments that you're using the ActiveXObject.Exec method, you can use the StdOut property of the WshScriptExec object that method returns. From MSDN's article on the StdOut property:

      if (!oExec.StdOut.AtEndOfStream)
      {
           input += oExec.StdOut.Read(1);
           //...
      }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜