JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 04.03.2020, 08:23
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default onmouseover description for custom toolbar buttons

Is it possible to add an 'onmouseover' 'description' for custom toolbar buttons that have been added and referenced from scripts?. I could not find any information in the global api or any options to add it from the menu customizer.
All JD2 default menu buttons have them.
Reply With Quote
  #2  
Old 04.03.2020, 12:21
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Currently not possible. You can use custom icons to tell them apart or add them as sub-menu items in the main menu or toolbar.
Reply With Quote
  #3  
Old 04.03.2020, 12:55
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default

Thanks mgpai, I'm already using custom icons but i will add them as sub-menus to also have button 'name' associated with them.
Reply With Quote
  #4  
Old 05.03.2020, 01:47
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default

mgpai,

Is it possible to set interval trigger for a script that "exports" to a text file.
I modified one of your scripts for package name exporting to a text file at different intervals but it is not triggering it. When I click 'test run' it exports the file with all the correct information to the proper location, however, the trigger does not seem to be working for it. I have tried different intervals from 3600000 to 21600000 but nothing works. Here is what I'm using:

Code:
// Export linkgrabber package names
// Trigger: Interval

{
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - package names.txt"; // <- Filename for exporting the URLs
    var myWavFile = JD_HOME + "/themes/standard/org/jdownloader/sounds/captcha.wav"; // path to 'wav' file
    var urls = [];

    getAllCrawledPackages().forEach(function(link) {
        var fileName = link.getName();
        urls.push(fileName);
    })

    if (urls.length) {
        if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
        writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
        //playWavAudio(myWavFile); // Uncomment this line to play sound file after file is created
    }
}

Last edited by RPNet-user; 05.03.2020 at 02:31.
Reply With Quote
  #5  
Old 05.03.2020, 06:59
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by RPNet-user View Post
I modified one of your scripts for package name exporting to a text file at different intervals but it is not triggering it.
Appears to be working fine. The timer is reset at JD start. It will not trigger if JD is shutdown before the countdown ends. Try smaller intervals for testing. For e.g. 5 mins. (5 * 60 * 1000).

How often do you want to export it?
Reply With Quote
  #6  
Old 05.03.2020, 09:55
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default

Quote:
Originally Posted by mgpai View Post
Appears to be working fine. The timer is reset at JD start. It will not trigger if JD is shutdown before the countdown ends. Try smaller intervals for testing. For e.g. 5 mins. (5 * 60 * 1000).

How often do you want to export it?
After i left the previous post, i accidentally left the interval at 1-minute(60000) for testing and forgot about it, till a few hours later when i checked on it, it had been exporting one txt file every minute for hours, so it is having a problem with the long interval times (hours) like every 8 hours(28800000). Should i use a different integer type for hours instead of "ms"?
Well it can't be the 'ms' cause my 1st interval script is working fine at every 8-hours, but script-2 and script-3 are also set for 8-hours but no exporting, sync is disabled for all three scripts, anyway, all three scripts are set for 8hrs(28800000) and i just restarted JD, i will check them later.
I decided to set script-1 interval at(28800000) script-2 interval at (28920000) and script-3 at (28980000) two minutes apart from each other since I need scripts-2/3 to run after the 1st script completes.

Ok so i decided to consolidate scripts-2/3 by merging them into one so now they export two txt files simultaneously. I tested it at one minute intervals then set it for 8-hrs-2min(28920000) to give the first script 2-min to complete. I restarted JD to reset timers for both intervals.

The 1st one ran 2hrs.20min before it should have and the 2nd one ran about 10min before it should have.

Last edited by RPNet-user; 06.03.2020 at 06:26.
Reply With Quote
  #7  
Old 06.03.2020, 14:45
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default

{
}
mgpai, is it possible to set an x amount of time between executing above script and bottom script?
{
}

I currently have scripts-2/3 merged into a single script and I'm trying to merge scripts-2/3 with script-1, however, I need scripts-2/3 to wait two minutes to execute after script-1.

These JD trigger intervals do not function properly when they are set for long amount of hours. Sometimes they work on schedule(somewhat) and sometimes they do not. I set the two scripts to run after 8 eight hours, yet they execute 1hr.42minutes later or whenever they want. Yes I clicked saved, completely exited JD, waited a couple minutes to re-start JD in order to reset counter/timer, yet it fails to run after the specified amount of time, and yes JD stays on 24x7. I have monitored up to 3 hours for different interval-tasks and they execute properly every time and on-time, however longer hours are intermittent and unreliable.

Last edited by RPNet-user; 06.03.2020 at 15:23.
Reply With Quote
  #8  
Old 06.03.2020, 15:10
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by RPNet-user View Post
... is it possible to set an x amount of time between executing above script and bottom script ...
Code:
// sleep(myInt/*milliseconds*/);/*Perform a sleep and wait for x milliseconds*/

alert("first message"); // Execute this code ...
sleep(1 * 60 * 1000); // ...  wait for 1 minute ... 
alert("second message"); // .. then execute this code
Reply With Quote
  #9  
Old 06.03.2020, 16:05
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by RPNet-user View Post
These JD trigger intervals do not function properly when they are set for long amount of hours.
Should be possible to run at specified time using this script.
Code:
// Run script at user-specified time
// Trigger: Interval
// Set interval to 1000 ms

var schedule = [];
var addSchedule = function(hours, minutes) {
    schedule[schedule.length] = new Date().setHours(hours, minutes, 0, 0);
}

// Syntax: addSchedule(hours,minutes);
addSchedule(00, 00);
addSchedule(08, 00);
addSchedule(16, 00);

var currentTime = new Date().setMilliseconds(0);

if (schedule.indexOf(currentTime) > -1) {
    // Script content goes here
}
Reply With Quote
  #10  
Old 06.03.2020, 16:18
RPNet-user's Avatar
RPNet-user RPNet-user is offline
Tornado
 
Join Date: Apr 2017
Posts: 231
Default

Thanks mgpai,

I just tested both and they work perfectly.

I tested the sleep-script first with the 3-merged scripts and it ran perfectly, then I added your 2nd script to run at the specified time which also ran perfectly.
By the way, this is great that I can add the schedule,... easier and more manageable than just randomly set interval triggers.

Last edited by RPNet-user; 06.03.2020 at 17:09.
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 07:24.
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.