[JDownloader] Setup for Windows, Linux and Mac OS X

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 04 Mar 2016, 23:57

Welcome to the official JDownloader help & support topic!


Automated Media Center

This guide will help you with setting up the FileBot AMC Script script with JDownloader. We'll add our own Event Scripter event script, which passes some arguments along to our shell script, which then calls filebot as usual.
  1. Install the Event Scripter plugin
  2. Add the Execute FileBot (PackageFinished) script
  3. Add the Execute FileBot (ArchiveExtracted) script
  4. Download the jdownloader-postprocess.sh (Mac and Linux) or jdownloader-postprocess.cmd (Windows) script, make sure it's executable, and place it in the JD_HOME folder.

    The script location is set in the first line:

    Code: Select all

    var script = '/path/to/jdownloader-postprocess'

You may edit the configuration files directly if you are running JDownloader on a headless server:
org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json


Known Issues:
  • The PackageFinished script is called before extraction is complete. The ArchiveExtracted script is called for each individual archive. In order to avoid FileBot processing partially extracted files it is recommended that extraction is disabled in JDownloader and enabled in FileBot via the --def skipExtract=n option.
If something is not working, please read Shell Script Debugging for Beginners and make sure it's not a simple $PATH or permission issue.
:idea: Please read the FAQ and How to Request Help.

Effe
Posts: 1
Joined: 15 Sep 2017, 10:05

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by Effe » 15 Sep 2017, 10:22

I need help with this script.

I followed the guide, I get no error, but the files are not renamed.

otr
Posts: 7
Joined: 06 Aug 2018, 20:37

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by otr » 07 Aug 2018, 10:01

I would like to ask for help with this. I'll put this in a way so that it may help others in the future as well.
My setup: DS218play, jDownloader headless + my.jdownloaderorg as GUI + filebot.

This is a screen capture of the GUI that I have. I fail to enter the scripts (e.g. https://github.com/filebot/plugins/blob ... inished.js) via c&p (plus modifying path) into that window. I get an error (failed to set new value).

Image

My question: Is that even the right way? Or do I need to follow the headless path that you describe above?
In that case,
- where do I put that script?
- can you provide the second script as JSON as well please? The provided one only works for "ON_PACKAGE_FINISHED", but not for ArchiveExtracted.

Thanks!

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 07 Aug 2018, 10:21

I've never used the JD WebUI. It looks very basic. I guess it's just a simple interface so you can write the org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json configuration file.

You can try to just copy the raw JSON:
https://github.com/filebot/plugins/blob ... ripts.json

The easiest way is probably to log in via SSH, find the configuration files, and then write them directly, and restart JD:

Code: Select all

find /volume1 -iname '*EventScripterExtension*'
:idea: You can use the JD desktop app and setup Event Scripter that way, and the just copy the configuration file.
:idea: Please read the FAQ and How to Request Help.

hansooloo
Posts: 30
Joined: 06 Feb 2016, 14:58

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by hansooloo » 09 Aug 2018, 21:00

Take a look at this shell script I created for my setup where I was running into the exact same issue: https://gist.github.com/HanSooloo/89528 ... 2668b0330e

You _will_ need the `jq` package, which is readily available on both macOS (via brew) or any Linux distribution.

otr
Posts: 7
Joined: 06 Aug 2018, 20:37

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by otr » 17 Aug 2018, 12:10

Hi,

sorry for being silent for a bit, I have been on a short trip. In the meantime, my setup is now working and I wanted to report back my specifics, so that others may benefit, but also so that I can learn in case I have missed something important.

This is what is working for me:

1. jDownloader Event Scripter calls this script

Code: Select all

[{"eventTrigger":"ON_PACKAGE_FINISHED", "enabled":true, "name":"FileBot", "script":"var amcFile = '/volume1/Downloads/jdtofilebotv2.sh';var path = '/volume1/Downloads/'; callAsync(function() {}, amcFile, path);", "eventTriggerSettings":{}, "id":123654}]
For people that were new to this, just like me:
- The above is the exact "text" that you can see in the jDownloader UI. Compare this screenshot: https://snag.gy/kYHCEN.jpg
- id:123654 is a random number I thought of. The way I understand it this is the ID the process runs under and I would be able to find it under this ID, if I had to look for it.

2. the jdtofilebotv2.sh script that is called above

Code: Select all

#!/bin/sh
export JAVA_OPTS="-Xmx256m"
/var/packages/filebot/target/filebot.sh -script 'fn:amc' /volume1/Downloads --output /volume1/Media/ --conflict auto --lang en --def 'clean=y' 'skipExtract=y'  'excludeList=.excludes'
I would be happy to get comments on this, especially since people later might look at this and assume that I did smart things (I did not - I just figured out what works for me somehow).
One issue I have is that I still do not find the filebot log file created by this setup.

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 17 Aug 2018, 20:03

1.
filebot should work just fine instead of /var/packages/filebot/target/filebot.sh but should you need an absolute path for some reason, then /usr/local/bin/filebot is recommended.


2.
-non-strict is generally used in all my examples, since strict mode tends to be too strict for what people use the amc script for usually.


3.
--log-file /path/to/log is recommended so you know exactly where the FileBot log is. This option will make sure that logs are written to both console and file.
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 18 Jan 2019, 18:45

Hello,

I am trying to setup and run your JDownloader script and can't seem to get it to work.

I am using Windows 10 64 bit and JDownloader2 (instead of JDownloader) to download my files to a folder and that is the folder I would then like to be processed by filebot and you AMC script.

I figured out how to install the scripting plugin in to JDownloader2 and I created a script based on what you posted here and the following web site https://github.com/filebot/plugins/tree ... downloader .

When I test run it in the scripter it seems to work but nothing is happening when the download completes. My files are not processed by filebot or the AMC script.

I'm new to this and trying to learn, please help. Also where do I put the files I download that you created if that is the issue.

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 18 Jan 2019, 18:53

The first step is to figure out if JDownloader is calling your scripts at all. The JDownloader logs might give some indication. JDownloader forums might also be helpful on general JDownloader help and support.


Note that if you're on Windows, you'll need to use the *.cmd script and not the *.sh script, so you'll modify this line:

Code: Select all

var script = JD_HOME + '/jdownloader-postprocess.sh'
and replace it with the path to your *.cmd script:

Code: Select all

var script = 'C:/jdownloader-postprocess.cmd'
where script is the absolute path to the cmd script you want to execute, i.e. jdownloader-postprocess.cmd
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 20 Jan 2019, 18:27

Sorry for the late reply and thanks for the suggestion.

I did make a event script/trigger from other things I read and added your suggestion. Here is the event script/trigger :

Code: Select all

[{
    "eventTrigger": "ON_PACKAGE_FINISHED",
    "enabled": true,
    "name": "Execute FileBot (PackageFinished)",
    "script": "var script = 'C:/jdownloader-postprocess.cmd'\n\nvar path = package.getDownloadFolder()\nvar name = package.getName()\nvar label = package.getComment() ? package.getComment() : 'N/A'\n\nvar command = [script, path, name, label, 'PACKAGE_FINISHED']\n\nlog(command)\nlog(callSync(command))\n",
    "eventTriggerSettings": {}
}]
It shows everything is ok in the scripter gui and i get no errors on the test run i did but it doesn't seem to work still. I did as you said and asked for help in the JDownloader forum under scripting too. Thanks for your help and anymore you can give. I wasn't able to figure out the logs I found where they were but there is a ton of them and I am not sure which is for what I am doing.

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 21 Jan 2019, 02:12

Is your C:/jdownloader-postprocess.cmd script called at all? That is the first step we need to clear.


If it's not called, then maybe because the JDownloader hook doesn't work, which means we simplify:

Code: Select all

var command = ['C:/Windows/System32/notepad.exe']
log(command)
log(callSync(command))
Just call that one command, nothing else, can't not work, should pop up notepad, unless it's a JDownloader bug / issue, which means we know where to start fixing things.
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 10:48

Thanks for the reply.

What you gave me to try worked. (as far as executing notepad.exe)

I wasn't able to find out or figure which log was for JDownloader2 and the script I was trying though. So I don't know if it actually runs the CMD file.

Thanks again for the help.

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 21 Jan 2019, 10:54

1.
If notepad.exe is called, then we know that works, so the next step is to do the same with C:/Windows/System32/cmd.exe /c C:/script.bat.


2.
Just write a script that does something like this:

Code: Select all

DATE /T > C:\date.txt
If the CMD script is called, then C:\date.txt will be created.
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 11:29

Ok so this is what I put in the scripter for my script.

var command = ['C:/Windows/System32/cmd.exe /c C:/script.bat']
log(command)
log(callSync(command))

I also created a BAT file with DATE /T > C:\date.txt inside of it and saved it to C for it to be called.

When I did a test run in the scripter in JDownloader2 it came back with an error.

Image

Does the error mean it is not finding the cmd program?

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 21 Jan 2019, 11:44

Well, I don't use Windows. :P Where's cmd.exe on your system?
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 12:07

LOL, sorry but unfortunately it's the machine I am doing this on right now. I prefer linux myself though.

It is here :

Code: Select all

C:\Users\Chris Chester\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools
Does it matter if I use single quotes vs double quotes when doing the script?

This is the script now

Code: Select all

var command = ['C:/Users/Chris Chester/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/System Tools/cmd.exe /c C:/script.bat']
log(command)
log(callSync(command))
I will try that path and see if it works

Code: Select all

var command = ["C:/Users/Chris Chester/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/System Tools/cmd.exe /c C:/script.bat"]
log(command)
log(callSync(command))
:arrow: https://drive.google.com/file/d/1mIZ5rb ... sp=sharing

Same results either way.

This seems very simple but I am not sure why it just is not working. I do really appreciate your help on this.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 12:14

I also tried alone to try and launch the command window by itself like notepad with this:

Code: Select all

var command = ["C:/Users/Chris Chester/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/System Tools/cmd.exe"]
log(command)
log(callSync(command))

Still got errors

Wrapped org.jdownloader.extensions.eventscripter.EnvironmentException: Line 3
java.io.IOException: Cannot run program "C:/Users/Chris Chester/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/System Tools/cmd.exe": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:215)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:201)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:196)
	at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callSync(ScriptEnvironment.java:247)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:120)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitPermissionRestricter.java:119)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
	at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
	at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
	at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
	at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
	... 22 more
 (#3)

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 12:35

I did go back and try just launching cmd.exe by itself in the script but got the same results even though I verified that is where cmd.exe is:

Code: Select all

var command = ['C:\Windows\System32']
log(command)
log(callSync(command))
so still no luck

Code: Select all

net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped org.jdownloader.extensions.eventscripter.EnvironmentException: Line 3
java.io.IOException: Cannot run program "C:Windows System32": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:215)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:201)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:196)
	at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callSync(ScriptEnvironment.java:247)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:120)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
	at script(:3)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitPermissionRestricter.java:119)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
	at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
	at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
	at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
	at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
	... 22 more
 (#3)
	at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1907)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:146)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitPermissionRestricter.java:119)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
	at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
	at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
	at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
	at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)
Caused by: org.jdownloader.extensions.eventscripter.EnvironmentException: Line 3
java.io.IOException: Cannot run program "C:Windows System32": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:215)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:201)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:196)
	at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callSync(ScriptEnvironment.java:247)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:120)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitPermissionRestricter.java:119)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
	at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
	at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
	at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
	at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
	... 22 more

	at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callSync(ScriptEnvironment.java:250)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:120)
	... 12 more
Caused by: java.io.IOException: Cannot run program "C:Windows System32": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:215)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:201)
	at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:196)
	at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callSync(ScriptEnvironment.java:247)
	... 17 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
	... 22 more

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 14:45

If I run the command from the command line I get:

Code: Select all

C:\>jdownloader-postprocess.cmd
The syntax of the command is incorrect.
C:\><!DOCTYPE html>
I don't know if it is the correct way to try it.

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 21 Jan 2019, 14:52

1.
Did you just "Save as..." a web page and then run it as CMD script? :lol:

Here's what a CMD script looks like:
https://raw.githubusercontent.com/fileb ... rocess.cmd

Here's what a HTML web page looks like:
https://raw.githubusercontent.com/fileb ... index.html


2.
Now, the first step is to actually have a working cmd script, but then it'll still probably not work right away, because Windows, and then we're back to where we started. :lol:

:!: I'm not sure if this tutorial is for you. Looks like you're gonna struggle hard every step of the way. :roll:


3.
Here's some general debugging tips. (a) You can't execute a folder. (b) Read the error message. Doesn't this look strange? No \ here? That's because in "..." the \ character almost always has special meaning, meaning that you can't use it literally. (not your fault, Windows engineers made really really bad decisions back in the 80ies, and their mistakes are still coming back to haunt us all)

Code: Select all

Cannot run program "C:Windows System32"
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 15:28

LOL, apparently that is what I did, now that I look at both of them. I assumed what was there was what i needed so yeah I copied it. Oh well. Sorry for the frustration on my user error.

I saved the file that you just posted.

I will test things but running the cmd on it's own to see if it work then move back to the scripter.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 16:03

Ok, well I tried what you suggested and I get the following when running the command file you created from the command line on it's own.

C:\>jdownloader-postprocess.cmd
Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Mon Jan 21 10:50:59 EST 2019]
Parameter: skipExtract = y
Illegal usage: no input
Failure (°_°)

I also tried the script again just to see if would at least launch it even if it failed but I get nothing. I can't seem to find the correct log either.

var command = ['/jdownloader-postprocess.cmd']
log(command)
log(callSync(command))

I will keep trying and thanks for all the help. Sorry about the mistakes.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 21 Jan 2019, 16:05

Ok, well I tried what you suggested and I get the following when running the command file you created from the command line on it's own.

Code: Select all

C:\>jdownloader-postprocess.cmd
Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Mon Jan 21 10:50:59 EST 2019]
Parameter: skipExtract = y
Illegal usage: no input
Failure (°_°)
I also tried the script again just to see if would at least launch it even if it failed but I get nothing. I can't seem to find the correct log either.

Code: Select all

var command = ['/jdownloader-postprocess.cmd']
log(command)
log(callSync(command))
I will keep trying and thanks for all the help. Sorry about the mistakes.

User avatar
rednoah
The Source
Posts: 16988
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah » 22 Jan 2019, 05:27

Probably more like this:

Code: Select all

var command = ['C:\\absolute\\path\\to\\cmd.exe', '-c', 'C:\\absolute\\path\\to\\jdownloader-postprocess.cmd']
:idea: Using \\ instead of \ at all times, because \ is an escape character, and \\ is the literal \ character.
:idea: Please read the FAQ and How to Request Help.

chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 » 22 Jan 2019, 06:29

Thanks for replying

This is what I put in my script based on the info you gave and I have:

Code: Select all

var command = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd']
log(command)
log(callSync(command))
It didn't spit anything back in the JDownloader2 GUI

I found the log I think for it:

Code: Select all

------------------------Thread: 1792:ScriptEnvironment.log-----------------------
--ID:1792TS:1548138130189-1/22/19 1:22:10 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> [ "C:\\Windows\\System32\\cmd.exe", "-c", "C:\\jdownloader-postprocess.cmd" ]
--ID:1792TS:1548138132497-1/22/19 1:22:12 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Microsoft Windows [Version 10.0.17763.253]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Chris Chester\AppData\Local\JDownloader 2.0>
Not sure if it is working or not.

Post Reply