#1
|
|||
|
|||
Run external program with Event Scripter
Hi, I would like to run an .exe after a download finishes, for example putty, but this code does not work in Event Scripter. What I am doing wrong:
var oShell = new ActiveXObject("Shell.Application"); var commandtoRun = "C:\\putty.exe"; oShell.ShellExecute(commandtoRun, "", "", "open", "1"); Error: ActiveXobject is not defined Thanks |
#2
|
||||
|
||||
You've got to use the callAsync method
Code:
/* Example: */callAsync(function(exitCode,stdOut,errOut){ alert("Closed Notepad");},"notepad.exe",JD_HOME+"\\license.txt"); Syntax is Javascript but you don't have access to full browser environment!
__________________
JD-Dev & Server-Admin |
#3
|
|||
|
|||
Thank you Jiaz! What if I want to run it with attributes? For example
c:\\putty.exe -load “my_session” |
#4
|
||||
|
||||
from example above
Code:
callAsync(function(exitCode,stdOut,errOut){ alert("Closedotepad");},"c:\\putty.exe","-load","my_session");
__________________
JD-Dev & Server-Admin |
#5
|
|||
|
|||
Works great! Thank you very much
|
#6
|
||||
|
||||
You're welcome
__________________
JD-Dev & Server-Admin |
#7
|
|||
|
|||
Thanks Jiaz, torrero007,
I was struggling with a similar question: how to upload a completed file to my headless server. So for anyone using linux here's my version, triggered on Package finished. Code:
callAsync(function(exitCode, stdOut, errOut) { // alert("Upload Finished !"); }, "/home/your_name/.upload.py"); The file must be executable ( chmod +x filesname ) and have an appropriate hashbang ( #!/usr/bin/python3 ). Last edited by kiwi9; 13.03.2018 at 02:33. |
#8
|
||||
|
||||
@kiwi9: no params? how does your script knows where to look for the files?
__________________
JD-Dev & Server-Admin |
Thread Tools | |
Display Modes | |
|
|