Run suball script hidden

Any questions? Need some help?
Post Reply
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

Doesn't running a batch file always open a console window?

You could do something like this:
viewtopic.php?f=4&t=5157
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

Unfortunately, Windows makes it very tricky to run command-line executables without CMD popping up.

You're running a vbs script with the wscript executable. I'd use a python script and run it with the pythonw executable. It's exactly the same thing, but I'd argue that python is more user friendly than vbs. :lol:
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

You could write a generic python script that simply takes a number of arguments and then executes that as a command. The utorrent-postprocess.pyw script is not that.

Please read the script, understand what it does, and then modify it to your needs. It's very easy to read and modify.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

Forget the bat file. Use a python file instead. Call filebot from the python file.

You already have a working example for filebot/amc calls:
https://github.com/filebot/plugins/blob ... rocess.pyw

Now you just need to slightly modify that to call suball with the arguments you want:

Code: Select all

command = [
	'filebot', '-script', 'fn:amc',
	...
]

subprocess.run(command, creationflags=0x08000000)
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

1.
Does it not? What have you tried?


2.
Open CMD. Run it. See what the output says. If you use python you will see output. If you use pythonw you won't see output.

Code: Select all

# Test with Console:
# python "C:\path\to\utorrent-postprocess.pyw" "Movie" "5" "Avatar" "multi" "" "X:\Files\Avatar"
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

Since you're using the filebot command-line tools, I assume that you have at least very basic command-line skills.

You have a python script, you run it with the python executable. It takes 10 seconds and you can't really go wrong anywhere...

Anything you can run with CMD, can be scheduled with Windows Scheduler, so you've got that covered as well.


1. Create script
2. Run script
3. Done
Image

Now we have something that works. A few small modifications and it'll do what you want it to do. It's extremely simple.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

I've added another python script that will just execute a generic command passed in via command-line arguments:
https://github.com/filebot/plugins/blob ... t/runw.pyw

e.g.

Code: Select all

pythonw /path/to/runw.pyw filebot -script fn:sysinfo
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: Run suball script hidden

Post by ZeroByDivide »

rednoah wrote: 25 Jul 2017, 16:46 Unfortunately, Windows makes it very tricky to run command-line executables without CMD popping up.
I am able to run command-line executables (.bat, .cmd, .batch) without the CMD popping up just fine and I've never done anything fancy at all. The only time it'll ever pop up a cmd window is if I run the command-line executable manually (or if I'm running a .sh command-line executable since it's the only one I've never had suppressed for some reason), doing it through torrent clients/windows service/task scheduler or what have you it never pops up a window or anything. TBH it's one reason why I don't understand this post here - > viewtopic.php?f=4&t=5157 currently since it's already suppressed/doesn't pop up the cmd window.
Forn73 wrote: 26 Jul 2017, 18:35 Thank you for your effort!

Where does the suball script stores its logs? I can only find "AppData\Roaming\Filebot\logs\amc.log" Otherwise I don't know if it's working...
I think it's just the amc.log for the suball script just like any other script, it'll end up in the default location unless you specify where you want the log to go.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: Run suball script hidden

Post by ZeroByDivide »

Forn73 wrote: 26 Jul 2017, 19:56 And where is the default location? AppData? Windows?
believe it's the location you found in your post above, I don't really know the default log location since I don't have the logs point to the default location since I use

Code: Select all

log-file "path/to/amc.log"
in my code so I just point it to where I want so I can easily get the logs when needed instead of traversing through tons of folders to get to the logs.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run suball script hidden

Post by rednoah »

Specify a log file:

Code: Select all

--log-file D:/path/to/log.txt
Now you know where the log is.
:idea: Please read the FAQ and How to Request Help.
Post Reply