JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1241  
Old 14.03.2020, 14:26
zreenmkr zreenmkr is offline
JD Addict
 
Join Date: Feb 2020
Posts: 169
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 Beta
 
Join Date: Jan 2020
Posts: 56
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: 883
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 Beta
 
Join Date: Jan 2020
Posts: 56
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
JD Addict
 
Join Date: Feb 2020
Posts: 169
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 - https://www.autoitscript.com/autoit3/docs/functions/Send.htm

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
JD Addict
 
Join Date: Feb 2020
Posts: 169
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 Beta
 
Join Date: Jan 2020
Posts: 56
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
JD Addict
 
Join Date: Feb 2020
Posts: 169
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
JD Addict
 
Join Date: Feb 2020
Posts: 169
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
DSL User
 
Join Date: Sep 2019
Posts: 38
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: 657
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: 883
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: 657
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: 883
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: 657
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: 883
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: 657
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 Beta
 
Join Date: Feb 2018
Posts: 58
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: 883
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: 883
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
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 06: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 - 2020, Jelsoft Enterprises Ltd.