JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1241  
Old 14.03.2020, 14:26
zreenmkr zreenmkr is offline
Registered / Inactive
 
Join Date: Feb 2020
Posts: 174
Default

Quote:
should indicate the path of the executable, but what does '\\_bin' mean?
\ is to escape symbol
\\ is literally mean \ or use /
For example jd will see this path 'C:\Program Files\JDownloader 2.0\JDownloader2.exe' as 'C:Program FilesJDownloader 2.0JDownloader2.exe' because it was trying to escape P from Program and J from JDownloader and J from JDownloader2.exe.

So it has to be given 'C:\\Program Files\\JDownloader 2.0\\JDownloader2.exe'
Or 'C:/Program Files/JDownloader 2.0/JDownloader2.exe'


Quote:
IMPORTANT: Create sub-folder '_bin' in JD_HOME then download and copy 'notepadCmd.exe' to dir
JD_HOME is jd environment var for directory where jd is installed.
In this case copy 'jdHotkey.exe' into '_bin' folder you just created

Quote:
I click twice, the exe is executed but Jd does nothing
I thought you said before that you want to use it in EventScript.

It cannot be double clicking. Just call/put hotkeyCtrlDel(); anywhere in your script as desired and use any trigger you want then Ctrl+Del will be sent to JD


Quote:
I tried to narrow the keys with autohotkei and I came up with a similar thing
autoit is much better written, highly recommend that.

Quote:
how do I tell jd to run "JD-CtlrCancEnter.ahk" ?
or I have to recall in some way the executable / compiled "JD-CtlrCancEnter.exe"?
yes, you need to compile to executable then create a function as shown bellow and call/put hotkeyCtlrCancEnter(); in your script.

Code:
function hotkeyCtlrCancEnter()
    var exePath = JD_HOME + '\\_bin';
    var exeCmd = 'JD-CtlrCancEnter.exe'
    var hotkey = getPath(exePath + "\\" + exeCmd);
    callSync(hotkey);
}

Last edited by zreenmkr; 14.03.2020 at 14:38.
Reply With Quote
  #1242  
Old 14.03.2020, 17:36
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

@zreenmkr

- create the dir "_bin" in JD_HOME dir and download / extract the file ...
- create this code (botton press for test)

Code:
if (name == "test") {
     function hotkeyCtrlDel() {
        var exePath = JD_HOME + '\\_bin';
        var exeCmd = 'jdHotkey.exe'
        var hotkey = getPath(exePath + "\\" + exeCmd);
        callSync(hotkey, '-hkey');
    }
}
... and does nothing


Quote:
Originally Posted by zreenmkr View Post
\
I thought you said before that you want to use it in EventScript.

It cannot be double clicking. Just call/put hotkeyCtrlDel(); anywhere in your script as desired and use any trigger you want then Ctrl+Del will be sent to JD
yes , i want to use it in the script but :

-the file is *.exe
-in the script i say "execut this program here .."
es notepad
Code:
var textEditor = "notepad.exe";
    callSync(textEditor);
it opens the program notepad ( = double clik on notepad.exe )

So being an .exe why shouldn't it do what it has to if I click twice on it ??




while with autohotkey I have an exe that clicked 2 times does what it should but put in the script ... it does nothing

Code:
var hotkeyexe = getPath(JD_HOME + "/_bin/CtrlCancEnterJD.exe");
 callSync(hotkeyexe);
or
Code:
 function hotkeyCtlrCancEnter(){
    var exePath = JD_HOME + '\\_bin';
    var exeCmd = 'CtrlCancEnterJD.exe'
    var hotkey = getPath(exePath + "\\" + exeCmd);
    callSync(hotkey);
}
there will certainly be something missing / wrong but I don't understand what
Reply With Quote
  #1243  
Old 14.03.2020, 19:16
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

@BJN01: AHK Example

AHK Script (notepad.ahk):
Code:
run notepad
WinWait, Untitled - Notepad
WinActivate,  Untitled - Notepad
SendInput, %1%
Send, !fs

Calling the AHK Script in Eventscripter:
Code:
// AHK demo

var ahk = "C:\\AHK\\AutoHotkeyU32.exe";
var script = "C:\\AHK\\Scripts\\notepad.ahk";
var text = getAllDownloadLinks().map(function(link) {
    return [link.getPackage().getName(), link.getName(), link.getUrl()].join(", ");
}).join("\n")

callSync(ahk, script, text);
Reply With Quote
  #1244  
Old 14.03.2020, 20:04
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

thanks, I sign these codes and try something.


at the moment I solved by creating an * .exe with autoilt + this code

Code:
// send "{CTRL}{DEL} " + "{enter}" to  shortkey to JD
// In JD there is a command: <<clear filtered links>> ( setting\user interface\linkgrabber botton bar ..... the icon is a gray funnel)
//I matched it with a shost cut (ctrl + del)
// so this script is used to execute the command without having to physically press "{CTRL}{DEL} " 
// trigger = a download stopped -or- download controller stopped 

var hotkeyExe = getPath(JD_HOME + "/_bin/JDCtrlCancEnter.exe");
callSync(hotkeyExe);

code nel file au3 (I don't know if something is missing or if I could avoid some things ... but it works ... so ... i use it and convert to *.exe )

Code:
WinActivate("[TITLE:JDownloader 2]")
WinActive("[CLASS:SunAwtFrame]")
Send("{CTRLDOWN}{DEL}{CTRLUP}")
WinActivate("[TITLE:JDownloader 2]")
WinActive("[CLASS:SunAwtFrame]")
Send("{ENTER}")
WinActivate("[TITLE:JDownloader 2]")
WinActive("[CLASS:SunAwtFrame]")
Exit

I noticed that the command is executed even if the .exe is clicked twice (as I assumed).

(I have not yet understood what was wrong with the exe obtained from autohotkey ... but I think I will lose a little more time on it ... it makes me very angry.)


@zreenmkr = sorry if I ask you but could you tell me what you wrote in au3? I would like to try to understand why <jdHotkey.exe> doesn't work
Reply With Quote
  #1245  
Old 14.03.2020, 20:43
zreenmkr zreenmkr is offline
Registered / Inactive
 
Join Date: Feb 2020
Posts: 174
Default

Quote:
Calling the AHK Script in Eventscripter:
awesome, didnt know that could be done.

Quote:
I have not yet understood what was wrong with the exe obtained from autohotkey
its pretty much the same as autoit, its more benificial to focus on one.

Quote:
...I would like to try to understand why <jdHotkey.exe> doesn't work
a few params check was put in place to prevent exe executed by error such as double click

Quote:
...could you tell me what you wrote in au3...
Code:
Global $titleJd = '[CLASS:SunAwtFrame; TITLE:JDownloader 2]'

;help - **External links are only visible to Support Staff**
If Not WinExists($titleJd) Then Exit

; If no parameters has been entered
If $CmdLine[0] = 0 Then Exit

; Checking parameter
If $CmdLine[1] == "-hkey" Then
	; if the parameter check out

	If WinActive($titleJd) Then Send('{CtrlDown}{DEL}{CtrlUp}')
	;If WinActive($titleJd) Then Send('{F2}')
EndIf

Exit
Reply With Quote
  #1246  
Old 14.03.2020, 21:10
zreenmkr zreenmkr is offline
Registered / Inactive
 
Join Date: Feb 2020
Posts: 174
Default

Quote:
create this code (botton press for test)
...
... and does nothing
a function must be declared to then call it.
Code:
     if (name == "test") {
        hotkeyCtrlDel()
        //sleep(1000)
        //hotkeyCtlrCancEnter()
     }

     //Function 1
     function hotkeyCtrlDel() {
        var exePath = JD_HOME + '\\_bin';
        var exeCmd = 'jdHotkey.exe';
        var hotkey = getPath(exePath + "\" + exeCmd);
        callSync(hotkey, '-hkey');
    }


     //Function 2
     function hotkeyCtlrCancEnter() {
        var exePath = JD_HOME + '\\_bin';
        var exeCmd = 'CtrlCancEnterJD.exe';
        var hotkey = getPath(exePath + "\" + exeCmd);
        callSync(hotkey);
    }

Quote:
yes , i want to use it in the script but :

-the file is *.exe
-in the script i say "execut this program here .."
es notepad
Code:
Code:
var textEditor = "notepad.exe";
    callSync(textEditor);
if variable textEditor is declared as Local then it only work locally in side a function.
Code:
var textEditor = "notepad.exe";


Global as the name implied, will work everywhere in any function without declaring it again. (e.g. jd environment var JD_HOME is a good example of Global., also look into global const)
Code:
//notice no 'var' infront of 'textEditor'
textEditor = "notepad.exe";


take another look at this example
Reply With Quote
  #1247  
Old 14.03.2020, 21:21
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
Default

@zreenmkr = thank you !
Quote:
Originally Posted by zreenmkr View Post

a few params check was put in place to prevent exe executed by error such as double click
maybe this is it ? .. or not ...
i have 2 question:
1) there any difference in reversing the order of title and class?
Code:
 Global $titleJd = '[CLASS:SunAwtFrame; TITLE:JDownloader 2]'
Code:
 Global $titleJd = '[TITLE:JDownloader 2;CLASS:SunAwtFrame]'
2)
Code:
If $CmdLine[1] == "-hkey" Then
the double "=" is correct ?





p.s = I'm afraid I know the answer but by chance is there a shortcut for the link grabber tab and the download tab? (ctrl+ ??)
Reply With Quote
  #1248  
Old 14.03.2020, 21:42
zreenmkr zreenmkr is offline
Registered / Inactive
 
Join Date: Feb 2020
Posts: 174
Default

Quote:
1) there any difference in reversing the order of title and class?
makes no different

Quote:
the double "=" is correct ?
yes
= is assignment operator
== is comparison operator

Quote:
I'm afraid I know the answer but by chance is there a shortcut for the link grabber tab and the download tab?
I've been using Ctrl+Tab to go forward, Ctrl+Shift+Tab backward on those tabs. don't know if there is one for specific tab
Reply With Quote
  #1249  
Old 14.03.2020, 21:57
zreenmkr zreenmkr is offline
Registered / Inactive
 
Join Date: Feb 2020
Posts: 174
Default

Quote:
Code:
var ahk = "C:\\AHK\\AutoHotkeyU32.exe";
var script = "C:\\AHK\\Scripts\\notepad.ahk";
@BJN01 you might want to adapter @mgpai option that s/he pointed out to execute autohotkey/autoit source code directly without compiling it to save time on debugging

Code:
var autoitDir = 'C:\\Program Files (x86)\\AutoIt3';
var autoitExe = 'AutoIt3.exe';
//var autoitExe = 'AutoIt3_X64.exe';
var autoitPath = getPath(autoitDir + "\\" + autoitExe);

var scriptDir = C:\\AU3\\Scripts'
var scriptName = 'notepad.au3'
var scriptPath = getPath(scriptDir + "\\" + scriptName );

callSync(autoitPath , scriptPath , [text]);
Reply With Quote
  #1250  
Old 16.03.2020, 02:50
AlphaSlayer AlphaSlayer is offline
Registered / Inactive
 
Join Date: Sep 2019
Posts: 40
Default

Quote:
Originally Posted by mgpai View Post
The links are processed automatically only when there is a dedicated plugin or matching link crawler rule. If not, you may need to enable 'deedDecrypt' for those links in the script.

When you added the link manually, did you add a single link or multiple links? If you add a single link manually, JD automatically deep anaylses it to find any downloaded content from that link, even if there is not dedicated plugin or crawler rule.
Thank you for the explanation this has seemed to fix my problem.
Reply With Quote
  #1251  
Old 17.03.2020, 12:20
tunayx's Avatar
tunayx tunayx is offline
JD Legend
 
Join Date: Mar 2009
Location: Xp Sp3 wth Java 7 No Firewall / Turkey
Posts: 743
Default

I need an event script that disables the hoster: After 5 captcha resolve try fails for related hoster. Could you guys help?
Reply With Quote
  #1252  
Old 17.03.2020, 13:51
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by tunayx View Post
I need an event script that disables the hoster: After 5 captcha resolve try fails for related hoster. Could you guys help?
It is currently not possible to associate the captcha result with the download link which triggered it. You can track the total download attempts made by a link and disable related hosters based on that number.
Reply With Quote
  #1253  
Old 17.03.2020, 15:52
tunayx's Avatar
tunayx tunayx is offline
JD Legend
 
Join Date: Mar 2009
Location: Xp Sp3 wth Java 7 No Firewall / Turkey
Posts: 743
Default

Quote:
Originally Posted by mgpai View Post
It is currently not possible to associate the captcha result with the download link which triggered it. You can track the total download attempts made by a link and disable related hosters based on that number.
That's a good idea but how to create such script. I don't know script language.
Reply With Quote
  #1254  
Old 17.03.2020, 17:35
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by tunayx View Post
... how to create such script ...
Code:
// Disable pending links of user-specified hosts, after x retries
// Trigger: A Download Stopped

var myHosts = ["host.com", "host.org", "host.net"]; // <- set host names
var myMaxTries = 5; // <- set max. number of retries allowed

var host = link.getHost();
var totalTries = link.getSessionProperty("count") || 0;

if (myHosts.indexOf(host) > -1) {
    if (totalTries < 5) {
        if (link.isEnabled()) link.setSessionProperty("count", totalTries + 1);
    } else if (totalTries >= 5) {
        link.setSessionProperty("count", 0);

        getAllDownloadLinks().filter(function(link2) {
            return link2.getHost() == host && !link2.isFinished() && !link2.getSpeed();
        }).forEach(function(link3) {
            link3.setEnabled(false);
        })
    }
}
Reply With Quote
  #1255  
Old 17.03.2020, 20:46
tunayx's Avatar
tunayx tunayx is offline
JD Legend
 
Join Date: Mar 2009
Location: Xp Sp3 wth Java 7 No Firewall / Turkey
Posts: 743
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Disable pending links of user-specified hosts, after x retries
// Trigger: A Download Stopped

var myHosts = ["host.com", "host.org", "host.net"]; // <- set host names
var myMaxTries = 5; // <- set max. number of retries allowed

var host = link.getHost();
var totalTries = link.getSessionProperty("count") || 0;

if (myHosts.indexOf(host) > -1) {
    if (totalTries < 5) {
        if (link.isEnabled()) link.setSessionProperty("count", totalTries + 1);
    } else if (totalTries >= 5) {
        link.setSessionProperty("count", 0);

        getAllDownloadLinks().filter(function(link2) {
            return link2.getHost() == host && !link2.isFinished() && !link2.getSpeed();
        }).forEach(function(link3) {
            link3.setEnabled(false);
        })
    }
}
Is it possible set it for all host names? I ask it for all host names because the topic below:
Protecting captcha credits against endless loops:
https://board.jdownloader.org/showth...821#post459821
Reply With Quote
  #1256  
Old 18.03.2020, 10:33
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by tunayx View Post
Is it possible set it for all host names?
The earlier script in only a workaround and not a proper solution for your problem. It will disable the host even if the retries are not captcha related. For this reason it is better to use it only for problemetic hosts and not for all hosts.

Script which processes all hosts:
Code:
// Disable pending links of hosts, after x retries
// Trigger: A Download Stopped

var myMaxTries = 5; // <- set max. number of retries allowed

var totalTries = link.getSessionProperty("count") || 0;

if (totalTries < 5) {
    if (link.isEnabled()) link.setSessionProperty("count", totalTries + 1);
} else if (totalTries >= 5) {
    link.setSessionProperty("count", 0);

    getAllDownloadLinks().filter(function(link2) {
        return link2.getHost() == link.getHost() && !link2.isFinished() && !link2.getSpeed();
    }).forEach(function(link3) {
        link3.setEnabled(false);
    })
}
Reply With Quote
  #1257  
Old 18.03.2020, 14:12
tunayx's Avatar
tunayx tunayx is offline
JD Legend
 
Join Date: Mar 2009
Location: Xp Sp3 wth Java 7 No Firewall / Turkey
Posts: 743
Default

Quote:
Originally Posted by mgpai View Post
The earlier script in only a workaround and not a proper solution for your problem. It will disable the host even if the retries are not captcha related. For this reason it is better to use it only for problemetic hosts and not for all hosts.

Script which processes all hosts:
Code:
// Disable pending links of hosts, after x retries
// Trigger: A Download Stopped

var myMaxTries = 5; // <- set max. number of retries allowed

var totalTries = link.getSessionProperty("count") || 0;

if (totalTries < 5) {
    if (link.isEnabled()) link.setSessionProperty("count", totalTries + 1);
} else if (totalTries >= 5) {
    link.setSessionProperty("count", 0);

    getAllDownloadLinks().filter(function(link2) {
        return link2.getHost() == link.getHost() && !link2.isFinished() && !link2.getSpeed();
    }).forEach(function(link3) {
        link3.setEnabled(false);
    })
}
If I set trigger as "After captcha challange" will the latest script count failed captchas?
Reply With Quote
  #1258  
Old 18.03.2020, 14:44
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
Default

Hello there,

I run a Linux Distro and for Linux the "Move file(s) or package(s) to trash"-function does not work. Instead they get deleted completely. A ticket has been created.

Could this be solved via a script?

Running: kioclient move example.mp3 trash:/ in the terminal does the job.
Reply With Quote
  #1259  
Old 18.03.2020, 16:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by tunayx View Post
If I set trigger as "After captcha challange" will the latest script count failed captchas?
No. That trigger does not return download link object.
Reply With Quote
  #1260  
Old 18.03.2020, 17:28
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Sokub View Post
I run a Linux Distro and for Linux the "Move file(s) or package(s) to trash"-function does not work. Instead they get deleted completely. A ticket has been created. Could this be solved via a script?

Running: kioclient move example.mp3 trash:/ in the terminal does the job.
Warning: The script will remove links from download list/delete files from disk, without any confirmation. Use it on test links first.

Code:
/*
Remove selected links and move files to trash
Trigger: "Downloadlist Contextmenu Button Preseed"
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());
            if (file.exists()) callSync("kioclient", "move", file, "trash:/");
            link.remove();
        })
    }
}
Reply With Quote
  #1261  
Old 18.03.2020, 18:32
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
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: 743
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: 1,591
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 Adviser
 
Join Date: Feb 2018
Posts: 107
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: 72,951
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

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #1266  
Old 19.03.2020, 14:09
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
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 Adviser
 
Join Date: Feb 2018
Posts: 107
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: 1,591
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 Adviser
 
Join Date: Feb 2018
Posts: 107
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: 72,951
Default

Quote:
Originally Posted by Sokub View Post
You guys stay healthy too!
Home office & coffee
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #1271  
Old 19.03.2020, 20:17
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
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: 72,951
Default

Quote:
Originally Posted by Sokub View Post
:thumbup: ... ... that sounds good! ... same here!
Nice
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #1273  
Old 20.03.2020, 13:18
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
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: 72,951
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

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #1275  
Old 20.03.2020, 13:36
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
Default

... ... Yes, thank you, mgpai!
Reply With Quote
  #1276  
Old 20.03.2020, 23:13
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 113
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: 1,591
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 Adviser
 
Join Date: Jan 2020
Posts: 113
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: 1,591
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
JD Alpha
 
Join Date: Feb 2020
Posts: 21
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 01:28.
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.