Page 1 of 2

New option "On queue finish"

Posted: November 23rd, 2022, 5:04 pm
by KeesC
Hi,

I would like the PC to do things after the download has finished, One thing is to run my backup schedule and shutdown the PC.

Therefor I would like to see a new option in "On queue finish": the possibility to run a bat file. Then I can do whatever I like after the downloads.

Thanks,
Kees.

Re: New option "On queue finish"

Posted: November 24th, 2022, 12:54 am
by safihre
It's already possible. Just put the bat file in the Scripts folder and then click the hamburger menu icon, in the main interface, at the bottom you can select the script.
This action will be performed once, to make the script run every time you need to enable the Special setting queue_complete_pers.

Re: New option "On queue finish"

Posted: November 24th, 2022, 6:38 am
by KeesC
OK, thanks, I will check that.

Re: New option "On queue finish"

Posted: November 24th, 2022, 1:27 pm
by KeesC
I checked, but I can't select the bat file.

I have Test.bat in the scripts folder (besides Sample-PostProc.cmd / py / sh), but the On queue finish - pulldown shows the previous 4 options (shutdown Sabnzbd, shutdown PC, standby PC, hybernate PC).

What do I do wrong?

Re: New option "On queue finish"

Posted: November 24th, 2022, 2:12 pm
by safihre
See the wiki:
On Windows, the requirement is that the script's extension is listed in your system's PATHEXT environment variable.

So make sure bat is listed in there.

Re: New option "On queue finish"

Posted: November 24th, 2022, 3:36 pm
by KeesC
I checked:
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Re: New option "On queue finish"

Posted: November 24th, 2022, 3:45 pm
by KeesC
I checked the WIKI and discoverd that I must fill in "Script Folder" in Config-Folders.
Now I see the scripts and my bat file in the Queue Finish pull down.

Thanks for pointing me in the right direction.

Re: New option "On queue finish"

Posted: November 24th, 2022, 3:47 pm
by safihre
Ah yes of course. Just make sure you haven't put the script in the Program Files/SABnzbd directory, as each new update of SABnzbd will remove that folder.
Put it somewhere in your user folders and point SABnzbd to there!

Re: New option "On queue finish"

Posted: November 24th, 2022, 3:52 pm
by KeesC
Yes, I pointed to my tools-folder. Windows 10 does not allow me to change much in the standard Sabnzb installation folders.

Thanks again!

Re: New option "On queue finish"

Posted: November 25th, 2022, 6:23 am
by KeesC
Well, it is not working as expected. I chose the bat file and it works after the downloads have finished.

But the selection remains active, even over restarts of the PC. And I have not the option to clear the on-queue-finished selection, only the option to select something.

What should I do?

Re: New option "On queue finish"

Posted: November 25th, 2022, 7:03 am
by safihre
If you disable queue_complete_pers it will only be executed once.

What is your script trying to do?

Re: New option "On queue finish"

Posted: November 25th, 2022, 11:48 am
by KeesC
Queue_complete_pers is OFF.
At this moment it does nothing, it used to restart the PC.

In the hamburger menu I can *set* an action for an emtpy queue, how can I clear the action?

Re: New option "On queue finish"

Posted: November 25th, 2022, 1:16 pm
by safihre
Pick the most top option, it should be an empty one.

Re: New option "On queue finish"

Posted: November 25th, 2022, 1:35 pm
by KeesC
Ok, yes that works. I did'nt notice it was an empty selection.

Why is my bat file not a one-time action?

Re: New option "On queue finish"

Posted: November 25th, 2022, 2:17 pm
by safihre
Oh, it seems I am wrong.
For some reason scripts are always persistent while other options (like Shutdown PC) are reset after being fired, so indeed the script will run every time.
This seems quite strange to me.. but has been like this since a longggg time, so not sure if I can just fix it.

For now a ugly solution would be to call in your script the API with set_config and set "queue_complete" to empty.