JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 03.10.2018, 10:32
Skeeve Skeeve is offline
JD Adviser
 
Join Date: Feb 2010
Posts: 106
Default eventscripts - Bessere Doku?

Moin!
Gibt's irgendwo eine bessere, ausführliche Doku für den Eventscripter?

Konkret bin ich auf der Suche nach 2 Dingen:
  1. Gibt es eine Möglichkeit, während ein Script läuft, ein Statusfenster anzuzeigen? Oder muß das ein aufgerufenes Script selbst erledigen?
  2. Gibt es eine Möglichkeit einen anderen Editor als den eingebauten zu verwenden?
Reply With Quote
  #2  
Old 04.10.2018, 11:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,543
Default

1.) Was genau stellst du dir mit *Statusfenster* vor? Es ist möglich einen Info Dialog anzuzeigen via alert
2.) Du kannst das Script in einem beliebigen Editor deiner Wahl tippen und dann via Copy/Paste rüberkopieren. Ist ja normales Javascript.

Im JDownloader Editor befindet sich oberhalb des Editors eine Anzeige mit allen verfügbaren Objekten/Methoden welche bei dem aktuell gewählten Event-Trigger verfügbar sind.

Bei konkreten Fragen/Problemen am besten direkt hier
https://board.jdownloader.org/showthread.php?t=70525
fragen. mgpai ist ein Meister des Eventscripters
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 04.10.2018, 14:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,552
Default

@Skeeve:
  • If you mean console, a ticket (#84516) is pending for that feature. For trouble shooting you can use alert() (can cause JD to hang if the events are triggered in quick sucession) or log to file using the log() method.

  • You can use external editor to create/view/modify the script. Save it as JS file locally and use the require() method in the JD editor to access/run it. E.g. require("/myFolder/myScript.js");. You can load any local/remote resource using this method.


Last edited by Jiaz; 04.10.2018 at 14:58.
Reply With Quote
  #4  
Old 05.10.2018, 10:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,543
Default

__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 09.10.2018, 22:53
Skeeve Skeeve is offline
JD Adviser
 
Join Date: Feb 2010
Posts: 106
Default

Hi!
Sorry for not replying so long.

"alert" will pause the script. What I meant is something that pops up telling the user that the script started (it's already running then) and remains open until the script ends and tells the window to close.

Maybe even with a possibility to write information to this window if it's a long running process, updating a status bar or printing out some textual information.

Copy & Paste from an external editor to the JD Editor is a bit tedious. I like more @mgpai's proposal of require-ing an external script. Definitely something I will look into.

The List of methods is nice but not too helpful for someone who's not deeply involved in the inner workings of jDownloader. What I would like to see is more information about each of these methods. When to use them. What exactly is expected as inpuut and output by not jsut mentioning some black-box-class names but by explaining what these classes are.

Maybe my JS experience is not sufficient and it's not JD experience that's required, but I have the feeling that all those functions and methods could be very powerfull but I have no clue how to use them and for what purpose to use them.
Reply With Quote
  #6  
Old 10.10.2018, 08:48
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,543
Default

So you want some window to open up where you can write messages into it and after script has ended, either close by user or autoclose?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #7  
Old 10.10.2018, 08:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,543
Default

Quote:
Originally Posted by Skeeve View Post
What exactly is expected as inpuut and output
Hmm? myString = String, myBoolean= Boolean, myInt=Int and so on?
Maybe you can give examples what is unclear to you?


Quote:
Originally Posted by Skeeve View Post
black-box-class names but by explaining what these classes are.
Hmm? Can you give examples? Maybe I'm too deep into development and I can't see the problem, so would be nice if you can give examples
__________________
JD-Dev & Server-Admin
Reply With Quote
  #8  
Old 10.10.2018, 22:03
Skeeve Skeeve is offline
JD Adviser
 
Join Date: Feb 2010
Posts: 106
Default

Regarding the window - Yes. Exactly.

Code:
/* =============== Global API =============== */
/* =========  Methods =========*/
alert(myObject[]);/*Show a Message Box*/
What can myObject[] be? A string works, but why an object-array?

Code:
var myObject = callAPI(myString, myString, myObject[]);/*Call the MyJDownloader API*/
/* Example: */callAPI("downloadsV2", "queryLinks", { "name": true})
More info about the parameters please. "myString" is not very informative, is it?

And what can I do with the result of the call?


Code:
callAsync(myFunction, myString[]);/*Call a local Process asynchronous*/
/* Example: */callAsync(function(exitCode,stdOut,errOut){ alert("Closed Notepad");},"notepad.exe",JD_HOME+"\\license.txt");
This is completely unclear to me.

Code:
var myString = callSync(myString[]);/*Call a local Process. Blocks Until the process returns*/
/* Example: */var pingResultString = callSync("ping","jdownloader.org");
Whart will "myString" contain? STDOUT? STDERR? Both? Can I get the exit code? Will there be an exception when somethig failed in calling the external process?

Shall I go on? I think you get what I mean.
Reply With Quote
  #9  
Old 12.10.2018, 10:54
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,552
Default

Quote:
Originally Posted by Skeeve View Post
"alert" will pause the script. What I meant is something that pops up telling the user that the script started (it's already running then) and remains open until the script ends and tells the window to close.
In windows simple async messages (static or variable) can be displayed using 'msg' command . They an be closed manually or automatically (based on user specified time).

Code:
callSync("msg", "console", "static text");
callSync("msg", "console", link.getName());

Popups with more advanced options can be displayed using Window Script Host. In addition to closing them manually or based on user specified time, they can be also be kept open and closed automatically using 'taskkill' command when the script ends.

There might be similar alternatives in other OS too.
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 14:29.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.