#201
|
||||
|
||||
Quote:
Plus the script does not contain any linkcheckDone
__________________
JD-Dev & Server-Admin |
#202
|
|||
|
|||
What is the Advanced settings>EventScripter: API Panel Visible supposed to do?
I enabled it and restart JD2 and see no changes. I'd like to output some strings to debug my scripts in a convenient place (in the JD GUI) with log() function or else. How can I do that except checking the JD_HOME/logs/xxxx/ScriptEnvironment.log.0? |
#203
|
||||
|
||||
@fred_gaou:
it shows/hides the api help panel You could either use alert() to open a window that shows debug info or write our debug to some sort of debug/log file. Or do you have something else in mind?
__________________
JD-Dev & Server-Admin |
#204
|
|||
|
|||
strange syntax of color in script editor
Hi.
I escaped special characters. and then as shown below resulted. (run script is no problem.) thank you. |
#205
|
|||
|
|||
Garbled other language in scripts editor.
Hi.
sorry for ask so many. Garbled japanese language in scripts editor. Exists Change font method? thanks for support. |
#206
|
||||
|
||||
@pachi: try Settings-Avanced Settings-LAFSettings.fontname.
for example 'Arial Unicode MS' without ' I've created a ticket for the comment issue
__________________
JD-Dev & Server-Admin |
#207
|
||||
|
||||
Eventscripter does not yet support custom font from advanced settings
__________________
JD-Dev & Server-Admin |
#208
|
|||
|
|||
Using alert() to debug is doable. But I was asking just in case JD offered something like a debug console in the script panel or in a tab that would show all script output using the log() function. Those features won't prevent me from writing my script but would be a friendly way to do it.
|
#209
|
||||
|
||||
Thanks for the feedback! I like the debug console idea
__________________
JD-Dev & Server-Admin |
#210
|
|||
|
|||
[SCRIPT] Clean up and log finished packages
Trigger required: Interval
Please check the "Synchronous execution of script" box available in this edition panel to avoid multiple script executions at the same time and log file corruption (even if it should not happen anyway). -------------------------------------- Author : freMea (myself) Version : 2017.10.30 Download link: gist.github.com/freMea/f2787b6c74097a4ef16cd21904f71517 -------------------------------------- D E S C R I P T I O N Every time interval the user specified (OPTIONS: interval - default is 5 minutes), the script runs in background to remove downloaded and completed packages from the download panel if they are older than specified time (OPTIONS: finished_since - default is 60 minutes). It is a better solution than the built-in feature option that remove packages as soon as they are completed because you may need to check some information about it before it gets removed from the list. In any case, with this script, even if you set it to remove finished packages as soon as they are downloaded, all the informations about downloaded packages that have been removed by the script will be logged in the chosen target folder (OPTIONS: logPath - default folder is "%temp%" and log file name is 'JD - removed packages.log"). This log file won't grow up endlessly, its size is controlled by option that remove entries that are older than specified age in days (OPTIONS: max_logged_days - default is 3). ----- Note 1: %temp% is the default temporary folder that is used by the operating system and applications available to the currently logged on user. On Windows just write %temp% in the address bar of file explorer to open it. If you want to customize the path (OPTIONS: logPath), I recommend to use / as a path separator no matter the OS you use, it will be translated correctly by JD even on Windows. Else if you want to use \ anyway, you will have to double it like c:\\path to\\my log. Note 2: At first script execution, you'll be prompted to allow script to call JD API and to do other actions, all required to make it work. (Use the OPTIONS section at the top of script to customize to your need) Last edited by fred_gaou; 31.10.2017 at 01:19. |
#211
|
|||
|
|||
Quote:
but just event script editor is not change... thank you for reply. |
#212
|
||||
|
||||
@fred_gaou: Thanks for the script. I made the link visible
I suggest to use interval trigger and iterate through packages, check for finished state and finished date and then proceed. your script executes and actively waits 1 hour. Your script has some flaws! It doesn't check for removed/changed package. if you reset/add stuff to the package while the script is waiting, it will remove even if downloads are still in progress
__________________
JD-Dev & Server-Admin |
#213
|
|||
|
|||
Quote:
Is there a way to get the creation date of a any file in a given path? |
#214
|
|||
|
|||
bug?
Let's say you have packages with disabled links (all are disabled for instance because of package context menu>disable).
Even if the progression is 0% if you use this script, it returns these packages as finished: Code:
var aPackages = getAllFilePackages(); /*Get a list of all packages*/ var sText = ""; //will be filled with content (or not :-) for (var i = 0; i < aPackages.length; i++) { var package = aPackages[i]; var packageName = package.getName(); var isFinished = package.isFinished(); sText += "Package " + (i + 1) + " : " + packageName + " (finished: " + isFinished + ")\r\n"; } alert(sText); Last edited by fred_gaou; 18.10.2017 at 01:07. |
#215
|
|||
|
|||
Quote:
I have to wait those bug to be solved to finish my script. |
#216
|
||||
|
||||
Quote:
__________________
JD-Dev & Server-Admin |
#217
|
||||
|
||||
Quote:
Code:
var myFilePath = getPath(myString/*Path to a file or folder*/);/*Get a FilePath Object*/
__________________
JD-Dev & Server-Admin |
#218
|
||||
|
||||
Quote:
getFinishedDate will be fixed with next Core update isFinished is no bug. Disabled Links are not counted! Links must be enabled and in finished state.
__________________
JD-Dev & Server-Admin |
#219
|
||||
|
||||
will be fixed with next core update
__________________
JD-Dev & Server-Admin |
#220
|
|||
|
|||
Quote:
i was can use japanese in script editor. |
#221
|
|||
|
|||
Don't worry, my script is ready with interval trigger and the algorithm you pointed. Just waiting next core update to deeply test it with getFinishedDate().
|
#222
|
||||
|
||||
Update got released yesterday
__________________
JD-Dev & Server-Admin |
#223
|
|||
|
|||
Well package.isFinished() returns true even if there are disable links whereas link.isFinished() returns false for disable links. There is some inconsistency for me. package.isFinished() should return false if it contains unfinished links, disabled or not. This is how the isFinished term is intuitively understood by the script programmer.
|
#224
|
||||
|
||||
For links the internal state is checked. But for packages only enabled links are checked. For example via packagizer/manual disabled mirror links in case they are needed later. In that case package would never finish.
__________________
JD-Dev & Server-Admin |
#225
|
|||
|
|||
Scripts list
Hey,
What about creating a introducing post in this thread that would only contains:
This thread growing up, it contains now more help, requests and support, etc. than actually scripts. I supposed this thread must be currently overwhelming for new comers that want list of available scripts. |
#226
|
||||
|
||||
Good idea But I don't have time to do this, so anyone is welcome to create such a post and keep it updated. I will make it sticky then.
@mgpai @fred_gaou Help is welcome
__________________
JD-Dev & Server-Admin |
#227
|
|||
|
|||
ES6 support
Could we hope to have ES6 features in our JS script?
Controlling variable scope is so much easier and cleaner with it as just an example. |
#228
|
||||
|
||||
@fred_gaou: I don't think so. The used javascript interpreter does only support very limited subset of features.
mozilla.github.io/rhino/compat/engines.html If you need such advanced features, I think it would be simplier to use Eventscripter to call an external javascript interpreter that supports more javascript features.
__________________
JD-Dev & Server-Admin |
#229
|
|||
|
|||
How about adding a button|link in JD settings/scripts toward this thread for user to see all available scripts?
|
#230
|
|||
|
|||
Clean up and log finished packages: script link
Hi,
I released my script you can find at some post before this one in this thread. Here is the direct link: Code:
board.jdownloader.org/showpost.php?p=410187&postcount=210 |
#231
|
||||
|
||||
@fred_gaou: You can post links that link to our board. Those are whitelisted.
Thanks for your contribution. Once such a *index* post exists, we can easily link it in eventscripter, great idea!
__________________
JD-Dev & Server-Admin |
#232
|
|||
|
|||
Save Link URLs
Code:
// Save Link URLs // Files will be created in default (Global) download folder // Trigger Required: A Download Stopped if (link.isFinished()) { var data = "<details><summary>" + link.getName() + "</summary><table>"; var urls = { "Content": link.getContentURL(), "Container": link.getContainerURL(), "Origin": link.getOriginURL(), "Referrer": link.getReferrerURL() }; for (x in urls) { if (urls[x]) data += "<tr><td>" + x + "</td><td> : <a href=\"" + urls[x] + "\">" + urls[x] + "</a></td></tr>"; } data += "</table></details>"; var folder = callAPI("config", "get", "org.jdownloader.settings.GeneralSettings", null, "DefaultDownloadFolder"); var date = new Date().toDateString().substr(4); var file = folder + "/" + date + ".htm"; writeFile(file, data, true); } |
#233
|
|||
|
|||
hi @mgpai
i am trying to find away to rename video files to the name of the archives name example mgpai.the.movie.rar contains fghjk.mp4 --rename--> mgpai.the.movie.mp4 edit but of course not limited to mp4.mkv/mp4/avi/wmv/flv etc. thanks Last edited by animus; 10.11.2017 at 15:56. |
#234
|
|||
|
|||
Packagizer has an option to rename files after extraction.
|
#235
|
|||
|
|||
Script for sending email after package finished
I came up with a way to send myself an email after a package is finished in JD. The trigger for the Event Scripter is "package finished". Here is the script:
Code:
//Add your script here. Feel free to use the available api properties and methods callAsync(function(exitCode, stdOut, errOut) {}, "C:\\sendEmail.exe", "-o", "tls=yes", "-t", "someone@gmail.com", "-u", "Download Completed:", package.getName(), "-m", "Download completed:", package.getName(), "-f", "youremail@gmail.com", "-s", "smtp.gmail.com:587", "-xu", "yourusername", "-xp", "yourpassword"); Info "C:\\sendEmail.exe" : the path were the sendEmail is in your PC "-t", "someone@gmail.com" : the address which will notified "-f", "youremail@gmail.com" : the address which will send the notification "-xu", "yourusername" : your username on the "-f" account "-xp", "yourpassword" : your password on the "-f" account You will need a very simple program called "Sendemail". Download the version with TLS support. You will also need to enable POP and IMAP in the Gmail account you will use to send the notification from (the "f" attribute email address). In addition you need to turn on the "Access for less secure apps" on this account or else the Gmail with block the access to the acount. I would like to thank Jiaz for helping me start and finish it. Hope it helps Last edited by torrero007; 17.11.2017 at 14:32. Reason: corrections |
#236
|
|||
|
|||
How to build an interactive script?
Hi,
with the new trigger-functionality now we can start a script on button-press. Very, very nice. With this scenario I want to build an interactive script with an datetime-picker at script start. For instance: 1. button pressed in JD-menu launches the script. 2. the script should launch a dialog box with a datetime-picker (at best there would be a cancel-button). 3. after input the script then processes the value ... (or abortes on cancel-button). Now my question: How to render the picker, because we have no html-canvas onto we can render the UI-elements (form, etc)? (The only GUI-canvas I see is the alert-popup, but can it blown up to a multifunctional UI-element?) Thx for reading this. A lot more thanks for a reply. Last edited by ottoS; 25.11.2017 at 19:16. |
#237
|
||||
|
||||
@ottoS: what for do you need the date picker exactly for? You could just let user enter input like hours:minutes:day...
__________________
JD-Dev & Server-Admin |
#238
|
|||
|
|||
Quote:
What I'm doing wrong? Sorry for the questions. |
29.11.2017, 15:07 |
MaybeGrimm |
Message deleted by Jiaz.
|
#239
|
|||
|
|||
@MaybeGrimm: The script which you have quoted, is used to embed comments to image file. In your other thread you mentioned you need a script which can create 'Single Info-file'. Can you please clarify as to which kind of script you are looking for?
|
#240
|
|||
|
|||
The single info file was a second option, but what I wanted was that the comments appear in the file metadata. Just that I didn't tought that was possible, but it's what I prefer (and what this script does, if I don't misunderstand).
|
Thread Tools | |
Display Modes | |
|
|