JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 14.11.2017, 15:39
torrero007 torrero007 is offline
DSL User
 
Join Date: Apr 2015
Posts: 35
Default 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
Reply With Quote
  #2  
Old 14.11.2017, 15:53
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 51,022
Default

You've got to use the callAsync method
Code:
/* Example: */callAsync(function(exitCode,stdOut,errOut){ alert("Closed Notepad");},"notepad.exe",JD_HOME+"\\license.txt");
See more examples here, https://board.jdownloader.org/showthread.php?t=70525
Syntax is Javascript but you don't have access to full browser environment!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 14.11.2017, 16:32
torrero007 torrero007 is offline
DSL User
 
Join Date: Apr 2015
Posts: 35
Default

Thank you Jiaz! What if I want to run it with attributes? For example

c:\\putty.exe -load “my_session”
Reply With Quote
  #4  
Old 14.11.2017, 16:40
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 51,022
Default

from example above
Code:
callAsync(function(exitCode,stdOut,errOut){ alert("Closedotepad");},"c:\\putty.exe","-load","my_session");
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 14.11.2017, 17:17
torrero007 torrero007 is offline
DSL User
 
Join Date: Apr 2015
Posts: 35
Default

Works great! Thank you very much
Reply With Quote
  #6  
Old 14.11.2017, 17:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 51,022
Default

You're welcome
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 10:47.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.