run .exe and pass param with java script
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.

