Вопрос

Here is my code for running exe using javascript. It's working fine. Is there a way for me to know:

  1. When the exe closed.
  2. Get a return value from this app.

Also, what is the difference between using ShellExecute & Run?

     var sExePath = "c:\\Debug\\WebToCardReader_Test.exe";
     var oShell = new ActiveXObject("Shell.Application");
     var oExec = oShell.ShellExecute(sExePath, "", "", "open", "1");
Это было полезно?

Решение

  1. Run allows you to set the boolean bWaitOnReturn flag, which blocks your script until the program returns.

  2. On that page, the VBScript sample simply assigns the command to a variable (as you've done with ShellExecute). I'm not sure if this works in JavaScript, but it's worth a shot.

    However, as you know, ShellExecute does allow you to store a return value.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top