JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1261  
Old 18.03.2020, 18:32
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

Thank you Script Master mgpai!

This works wonderful for the context menu!

But if I try to use it for the tool-bar it gives this error:
"Security Violation: Security Violation org.jdownloader.extensions.eventscripter.sandboxobjects.DownloadlistSelectionSandbox (#8)"

What am I doing wrong?
Reply With Quote
  #1262  
Old 18.03.2020, 19:35
tunayx's Avatar
tunayx tunayx is offline
JD Legend
 
Join Date: Mar 2009
Location: Xp Sp3 wth Java 7 No Firewall / Turkey
Posts: 655
Smile

Quote:
Originally Posted by mgpai View Post
No. That trigger does not return download link object.
Thank you very much for your help & efforts mgpai.

Best Regards
Tunay
Reply With Quote
  #1263  
Old 19.03.2020, 11:29
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 853
Default

Quote:
Originally Posted by Sokub View Post
But if I try to use it for the tool-bar it gives this error:
You will not be able to use it with other triggers, since it uses the download list selection property which is available only with context menu trigger.
Reply With Quote
  #1264  
Old 19.03.2020, 13:57
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

Quote:
Originally Posted by mgpai View Post
You will not be able to use it with other triggers, since it uses the download list selection property which is available only with context menu trigger.
Ah ... too bad! I was hoping to replace the Delete-Button in the Tool-Bar with this.

But thank you very much for your time and energy!

JD is the best! ;-)
Reply With Quote
  #1265  
Old 19.03.2020, 14:06
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,432
Default

Quote:
Originally Posted by Sokub View Post
JD is the best! ;-)
Thanks for your nice feedback and thanks to mgpai's helping hands here!

Stay healthy!

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1266  
Old 19.03.2020, 14:09
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 853
Default

Quote:
Originally Posted by Sokub View Post
I was hoping to replace the Delete-Button in the Tool-Bar with this.
I hope you know it is also possible to assign keyboard short cuts even to the eventscripter trigger buttons. Can select the links and just press a keyboard button to delete them. You can even remap the default 'del' key to it.
Reply With Quote
  #1267  
Old 19.03.2020, 14:48
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

Quote:
Originally Posted by mgpai View Post
I hope you know it is also possible to assign keyboard short cuts even to the eventscripter trigger buttons. Can select the links and just press a keyboard button to delete them. You can even remap the default 'del' key to it.
Thanks for mentioning this! ... I don't like to use the keyboard in general (maybe this is strange with me) .... but this gives me an idea for the tool-bar-button:

Would it be possible to simulate a keypress in a script? I.e. the keypress which I then designate to the context-menu-button-"Move to trash"?

Or if not, is it possible to execute an external bash-script from the tool-bar-button? ... and in this external script I could simulate the keypress with xdotool - command.

I know, it sounds kind of complicated, but it should work, shouldn't it?
Reply With Quote
  #1268  
Old 19.03.2020, 15:44
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 853
Default

Quote:
Originally Posted by Sokub View Post
Would it be possible to simulate a keypress in a script
Not directly. But can use external tools (like ahk or autoit in windows) in a script to do that.

Quote:
Or if not, is it possible to execute an external bash-script from the tool-bar-button?
Yes you can. It is pretty simple and can be executed using any trigger.

Example script for toolbar button trigger:
Code:
// Run external script
// Trigger: Toolbar Button Pressed

if (name == "myButtonName") {
    var myScript = "/path/to/bash/script.sh";
    callSync(myScript);
}
Reply With Quote
  #1269  
Old 19.03.2020, 18:10
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

Quote:
Originally Posted by mgpai View Post
Yes you can. It is pretty simple and can be executed using any trigger.

Ah ... wonderful! ... It is a bit slow ... but works like a charm! :-)

Thank you very much! ... Makes me happy!

You guys stay healthy too!
Reply With Quote
  #1270  
Old 19.03.2020, 19:03
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,432
Default

Quote:
Originally Posted by Sokub View Post
You guys stay healthy too!
Home office & coffee
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1271  
Old 19.03.2020, 20:17
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

Quote:
Originally Posted by pspzockerscene View Post
Home office & coffee
... ... that sounds good! ... same here!
Reply With Quote
  #1272  
Old 20.03.2020, 10:02
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,432
Default

Quote:
Originally Posted by Sokub View Post
:thumbup: ... ... that sounds good! ... same here!
Nice
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1273  
Old 20.03.2020, 13:18
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

Hey guys!

I am very proud of myself! ... Without even knowing what programming language these scripts are in, I managed to combine your 2 scripts, mgpai, into one ... the first one "Move to trash" and the other one "Play finished and unfinished files".

So now the script does move finished and unfinished files to trash and also deletes the links. In case another Linux-user is interested:

Code:
/*
Remove selected links and move files to trash
Trigger: "Downloadlist Contextmenu Button Pressed"
Customize download list context menu > Add a new "Eventscripter trigger" button > Rename it to "[Script] Remove links and move files to trash" (without quotes) > Change Icon (Optional)
*/

if (name == "[Script] Remove links and move files to trash") {
    var links = dlSelection.getLinks();

    if (links.length) {
        links.forEach(function(link) {
            var file = getPath(link.getDownloadPath());
            link.remove();
            if (file.exists()) {
                callSync("kioclient", "move", file, "trash:/");             
            } else {
                var partFile = getPath(file + ".part");

                if (partFile.exists()) {
                callSync("kioclient", "move", partFile, "trash:/");
                }
            }
        })
    }
}

Only unfinished youtube-files are not being moved to trash. I guess it is because of their strange naming. But in my case this is not a very big deal.

Would be glad, if this is of help for someone! ...
Reply With Quote
  #1274  
Old 20.03.2020, 13:28
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 52,432
Default

Quote:
Originally Posted by Sokub View Post
I am very proud of myself! ... Without even knowing what programming language these scripts are in, I managed to combine your 2 scripts, mgpai, into one ... the first one "Move to trash" and the other one "Play finished and unfinished files".
Nice!
This is only possible when the one who made them initially commented them well enough so thx mgpai

-psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
How to create a log || Wie man einen Log erstellt
Captcha FAQ EN || Captcha FAQ DE || Erste Schritte & Tutorials
JDownloader 2 Setup Download
-----=>Support Chat<=-----
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #1275  
Old 20.03.2020, 13:36
Sokub Sokub is offline
JD Beta
 
Join Date: Feb 2018
Posts: 58
Default

... ... Yes, thank you, mgpai!
Reply With Quote
  #1276  
Old 20.03.2020, 23:13
BJN01 BJN01 is offline
JD Beta
 
Join Date: Jan 2020
Posts: 56
Default

Good evening everyone,

....
..edit. ( sorry, solved found the problem)
.....




doing my tests I got a <STDOUT stream> with my data but I should divide them (for now I'm on two lines), there is a way to say (for example) that row 1 corresponds to "X" while row two is " Y "?

<data = callSync (myScript)> ----> the script return a stdout stream

in the "data" i have :
val 1
val 2

Last edited by BJN01; 20.03.2020 at 23:39.
Reply With Quote
  #1277  
Old 21.03.2020, 05:21
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 853
Default

@pspzockerscene, @Sokub : Happy I could help.

Quote:
Originally Posted by BJN01 View Post
... solved found the problem
Do you need help with the one which is still present in the post or is that the one you solved?
Reply With Quote
  #1278  
Old 21.03.2020, 09:52
BJN01 BJN01 is offline
JD Beta
 
Join Date: Jan 2020
Posts: 56
Default

yes , for the one still present in the post i need help , thank you


[that solved I deleted it ( =_=' ... I had a wrong path ... sorry)]
Reply With Quote
  #1279  
Old 21.03.2020, 10:40
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 853
Default

Quote:
Originally Posted by BJN01 View Post
... I got a <STDOUT stream> with my data but I should divide them (for now I'm on two lines), there is a way to say (for example) that row 1 corresponds to "X" while row two is " Y "?
Code:
var stdOut = callSync("cmd", "/c", "dir/b", "\\");
var array = stdOut.split("\r\n"); // Splitting string by lines vill result in an array
var X = array[0];
var Y = array[1];

alert("X : " + X + "\r\nY : " + Y);
Reply With Quote
  #1280  
Old 21.03.2020, 16:07
Heinz Heinz is offline
Baby Loader
 
Join Date: Feb 2020
Posts: 6
Default

Quote:
Originally Posted by mgpai View Post
Does this help? :
Code:
var startTime = new Date();
var page = getPage("http://www.google.com");
var endTime = new Date();
var loadTime = endTime - startTime;

alert(loadTime);
Is there any timeout possible for the getPage request?
Like if the page is not loaded after 10sec it should skip the request.

Code:
browser.setConnectTimeout(10000);
browser.setReadTimeout(10000);
Dont seem to help..

Code:
var browser = getBrowser();
try {
	browser.getPage("http://www.google.de/", 10000);
} catch (e) {                         
}
How could this be achieved? possible in any way?

Last edited by Heinz; 21.03.2020 at 16:24.
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 03:23.
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 - 2020, Jelsoft Enterprises Ltd.