3 Replies Latest reply on Dec 4, 2011 9:10 AM by John Hawkinson

    run .exe and pass param with java script

    seko0101

      dear All

      can i execute .exe using java script and send parameter to the exe and get return value

      is that possible

       

      Thanks in advance

        • 1. Re: run .exe and pass param with java script
          Loic.Aigon Adobe Community Professional

          From my point of view, you can take advantage of doScript calling VB that in return will run a command line running the exe with parameters.

          I don't know much of VB but you can try playing with that snippet

           

          var Wscpt = "Dim oShell\
          Set oShell = CreateObject (\"WScript.Shell\")\
          oShell.run (\"cmd /K dir c:\\ > c:\\dump.txt & exit\")";
          
          var MScript = "do shell script \"echo hello world \"";
          
          var scpt = (File.fs=="Windows")? Wscpt : MScript;
          var language = (File.fs=="Windows")? ScriptLanguage.visualBasic : ScriptLanguage.APPLESCRIPT_LANGUAGE;
          
          
          app.doScript(scpt, language);
          
          

           

          You can still use File.execute() but unless I am wrong you cannot add parameters to that command.

           

          Loic

          • 2. Re: run .exe and pass param with java script
            seko0101 Level 1

            hi Loic_aigon

             

            thank you for your reply but,

             

            i will use this application to run at mac pcs is it will run ok

             

            or i need javascript only

            • 3. Re: run .exe and pass param with java script
              John Hawkinson Level 5

              Macs don't have .EXE files.

              You can do the equivalent AppleScript ("do shell script").

              If you need it to work on both platforms, you'll have to check which platform you're on and run the appropriate platform-specific code.

              Sorry, that's the way it is.

              1 person found this helpful