Execute Command on Completion

From Altbinz Wiki
Jump to: navigation, search

Since version 0.26.1, Alt.binz includes an Execute Command feature that runs after PAR2 checking, repairing or unraring is complete (whichever is last in the cycle).

The default execute command can be set in Setup > NZB #2, but commands can also be specified separately for any collection in the queue (right-click, choose Change Execute Command, edit entry in Execute column). The format for commands is:

   full_path_to_exe_bat_or_other "parameters"

Use $d for full download path without a trailing delimiter.

Use $u for full unrar path without a trailing delimiter.

Use $col for the collection name.

  • Examples:
   c:\util\MyCleanupRoutine.exe "-a $d"
   c:\util\CleanupAfterUnrar.bat "$d $u"
  • Sample script:

This logs all new files in download and unrar directories with date/time stamps. To use, copy the code, open Notepad, paste and save the file in your Alt.Binz directory (or anywhere else) as "logdownloads.bat" (*with* quotation marks).

Command: c:\program files\altbinz\logdownloads.bat "$d $u"

@echo off

set logfile=C:\dldlog.txt
if not exist %logfile% echo Alt.Binz Download Log > %logfile%

set dldir=%1
set undir=%2

if exist %dldir% for %%f in (%dldir%\*.*) do (call :log_files "%%f")
if exist %undir% for %%f in (%undir%\*.*) do (call :log_files "%%f")
goto :eof

find /I "%~nx1" "%logfile%" >nul
if %ERRORLEVEL%==0 goto :eof
for /f "tokens=*" %%t in ('time /t') do (set timet=%%t)
echo %DATE% %TIMET% %~dpnx1 >> %logfile%
goto :eof