#1241
|
|||||
|
|||||
Quote:
\\ 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:
In this case copy 'jdHotkey.exe' into '_bin' folder you just created Quote:
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:
Quote:
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. |
#1242
|
|||
|
|||
@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'); } } Quote:
-the file is *.exe -in the script i say "execut this program here .." es notepad Code:
var textEditor = "notepad.exe"; callSync(textEditor); 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); Code:
function hotkeyCtlrCancEnter(){ var exePath = JD_HOME + '\\_bin'; var exeCmd = 'CtrlCancEnterJD.exe' var hotkey = getPath(exePath + "\\" + exeCmd); callSync(hotkey); } |
#1243
|
|||
|
|||
@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); |
#1244
|
|||
|
|||
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 |
#1245
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
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 |
#1246
|
|||
|
|||
Quote:
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:
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 |
#1247
|
|||
|
|||
@zreenmkr = thank you !
Quote:
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]' Code:
If $CmdLine[1] == "-hkey" Then 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+ ??) |
#1248
|
|||
|
|||
Quote:
Quote:
= is assignment operator == is comparison operator Quote:
|
#1249
|
|||
|
|||
Quote:
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]); |
#1250
|
|||
|
|||
Quote:
|
#1251
|
||||
|
||||
I need an event script that disables the hoster: After 5 captcha resolve try fails for related hoster. Could you guys help?
|
#1252
|
|||
|
|||
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.
|
#1253
|
||||
|
||||
That's a good idea but how to create such script. I don't know script language.
|
#1254
|
|||
|
|||
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); }) } } |
#1255
|
||||
|
||||
Quote:
Protecting captcha credits against endless loops: https://board.jdownloader.org/showth...821#post459821 |
#1256
|
|||
|
|||
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); }) } |
#1257
|
||||
|
||||
Quote:
|
#1258
|
|||
|
|||
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. |
#1259
|
|||
|
|||
No. That trigger does not return download link object.
|
#1260
|
|||
|
|||
Quote:
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(); }) } } |
#1261
|
|||
|
|||
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? |
#1262
|
||||
|
||||
Thank you very much for your help & efforts mgpai.
Best Regards Tunay |
#1263
|
|||
|
|||
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.
|
#1264
|
|||
|
|||
Quote:
But thank you very much for your time and energy! JD is the best! ;-) |
#1265
|
||||
|
||||
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 |
#1266
|
|||
|
|||
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.
|
#1267
|
|||
|
|||
Quote:
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? |
#1268
|
|||
|
|||
Not directly. But can use external tools (like ahk or autoit in windows) in a script to do that.
Quote:
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); } |
#1269
|
|||
|
|||
Quote:
Ah ... wonderful! ... It is a bit slow ... but works like a charm! :-) Thank you very much! ... Makes me happy! You guys stay healthy too! |
#1270
|
||||
|
||||
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1271
|
|||
|
|||
... ... that sounds good! ... same here!
|
#1272
|
||||
|
||||
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#1273
|
|||
|
|||
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! ... |
#1274
|
||||
|
||||
Quote:
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 |
#1275
|
|||
|
|||
... ... Yes, thank you, mgpai!
|
#1276
|
|||
|
|||
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. |
#1277
|
|||
|
|||
@pspzockerscene, @Sokub : Happy I could help.
Do you need help with the one which is still present in the post or is that the one you solved? |
#1278
|
|||
|
|||
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)] |
#1279
|
|||
|
|||
Quote:
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); |
#1280
|
|||
|
|||
Quote:
Like if the page is not loaded after 10sec it should skip the request. Code:
browser.setConnectTimeout(10000); browser.setReadTimeout(10000); Code:
var browser = getBrowser(); try { browser.getPage("http://www.google.de/", 10000); } catch (e) { } Last edited by Heinz; 21.03.2020 at 16:24. |
Thread Tools | |
Display Modes | |
|
|