binhex Posted May 2, 2007 Report Share Posted May 2, 2007 hi, i have a question about the feature "run this program when a download finishes" which you can select per torrent. my question is with regards to the %D variable, is there a way of calling this from a batch file?, my reason is that i would like to write a batch file which does multiple processes, such as strip tag info, unzip, unrar etc when the torrent finishes, but if i use a batch for this then i cannot use the %D variable and thus cant tell the batch file where to find the downloaded files. is there a way of referencing this variable or is there another way around doing this using a batch file?.any replies most appreciated!. Link to comment Share on other sites More sharing options...
Spartakus Posted May 2, 2007 Report Share Posted May 2, 2007 Batch uses %1 %2 %3 ... etc to reach command line arguments/parameterseg: C:\MyScript.cmd %D D:\UnraredIn your batch file, %D would be %1 and D:\Unrared would be %2 and so on. PS. Check my app in my sig Link to comment Share on other sites More sharing options...
binhex Posted May 4, 2007 Author Report Share Posted May 4, 2007 hi spartakus, thanks for your reply, im a little confused by your example however, let me try and explain what im attempting to achieve:-in utorrent i have the following command run when completed:- rar x -df -r -o- %D\*.r* %Dhowever there are times when i also run this command on complete:-tag --recursive --remove "%D\*.mp3"so ideally i would like to point utorrent at a batch file which contains both commands, so the batch file would readrar x -df -r -o- %D\*.r* %Dtag --recursive --remove "%D\*.mp3"however the %D variable that utorrent identifies as the destination folder where the download has completed is only identified when the command runs from utorrent, if i use a batch file it doesnt know what %D is. i have also tried your suggestion of replacing %D with %1 in the batch file, but it still doesnt run against the downloaded files. i have checked your app out and it does look useful but i want to be able to do more than just unrar, ideally i want to be able to run different commands depending on the type of file which i dont think your util does?. Link to comment Share on other sites More sharing options...
Alpha-Toxic Posted May 4, 2007 Report Share Posted May 4, 2007 you will have to do this:lets say the .bat file is called mybatfile.batfrom uT you will call it withmybatfile.bat %Dthe .bat file itself will look like thisrar x -df -r -o- %1\*.r* %1tag --recursive --remove "%1\*.mp3"in othe words, you use %D to call the file and %1 inside of it (as %D is the FIRST argument you pass to the .bat file, next argument will be %2 and so on) Link to comment Share on other sites More sharing options...
Spartakus Posted May 4, 2007 Report Share Posted May 4, 2007 I must say I'm a little confused...µTorrent will translate the line C:\MyScript.cmd %D D:\UnraredintoC:\Myscript.cmd D:\Downloads\Some.Cool.Show.S01E01.HDTV.XVID-GRP D:\UnraredMyScript.cmd will see the parameters asC:\MyScript.cmd %1 %2%1 = D:\Downloads\Some.Cool.Show.S01E01.HDTV.XVID-GRP%2 = D:\UnraredContents of MyScript.cmd:"C:\Program Files\Winrar\unrar.exe" x -r %1\*.rar %2...which in runtime would be:"C:\Program Files\Winrar\unrar.exe" x -r D:\Downloads\Some.Cool.Show.S01E01.HDTV.XVID-GRP\*.rar D:\UnraredForgive me if I still don't see your point here...Anyway, why would you remove the files you are seeding? That's would most likely lead to an error in the script or µTorrent complaining about missing files...Btw, SCRU is strictly for unpacking. The source is available for modification to your liking. Link to comment Share on other sites More sharing options...
binhex Posted May 4, 2007 Author Report Share Posted May 4, 2007 thanks for your replies spartakus and alpha-toxic, i now see what you mean, i was simply just running a batch file on completion in utorrent such as "utorrent.bat" with no variable used and referencing the %D in the batch file itself, i now understand what you mean by using the %1 in the batch file.oh yeah btw spartakus the -r switch is recursive for the rar.exe, it doesnt remove the rar files, im assuming thats why you said "Anyway, why would you remove the files you are seeding? That's would most likely lead to an error in the script or µTorrent complaining about missing files..."i did like the look of scru but i need a more flexible approach to run different commands on different file types, thus im going down the route of using a batch file, might make a nice feature addon for scru? :-). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.