
Good day. I read about different bundles of Dropbox and utorrent, but not one did not suit me. Based on the experience of downloads earlier, there was only one thing to do if you did not immediately specify the place where to save the desired file name, then it will remain in the “Not parsed” folder with the name Avatar.2009.Extended.Collectors.Cut (1080p) .mkv ". Even if you later analyze the downloaded files, it will be necessary to restart the torrent files and specify the new path to the file to distribute them. And if you consider that at home, in addition to me, parents and niece are watching films, then this name could not be left.
So the necessary requirements for the program:
1. adding torrents remotely without connecting to a home computer (DC);
2. the ability to specify the path to the file on the DC;
3. the ability to specify the name of the file being downloaded;
4. remotely track which files were set to download, which completed the download.
How to solve the problem
First point
Appeal to the help utorrent.exe is obtained to add a torrent, you must run the following command:
C:\Program Files\uTorrent>uTorrent.exe /DIRECTORY " " " "
From the same help and search in Google, as well as the utorrent forum, it turned out that the name of the file to be downloaded cannot be specified on the uTorrent command line. At the beginning, he executed the command, but with the further implementation of the program I had to remove the
/DIRECTORY " "
from the line, I will tell about it below.
')
Second point
It is necessary that the Dropbox folder has the same folder structure as on the home computer where the downloaded file is saved. Next, saving the torrent file to the desired directory of the Dropbox folder, we can add the torrent to the DC in the directory that we need. To do this, it was necessary to provide automatic synchronization of the folder structure with the DC and the folder in the DropBox. How exactly the search for torrent files and synchronization of the folder structure is implemented will not be disassembled, since there is nothing special there.
After synchronization, the Dropbox folder looked like this:

Third point
There is a problem with the file name. The name of the torrent file and the names of the files that are downloaded through this torrent are two different things. At the uTorrent command line when adding, it was also impossible to specify with what name to save the file. Again began to look for information. It turned out that you cannot change the torrent file, because then he becomes an “invalid” and cannot be added to the download. And here AutoIT comes to the rescue with its ability to access the form element of another program. Before this, from the command line uTorrent remove / DIRECTORY "Directory where to save", so that a window appears on the addition of the torrent. Then I had to find out the name of the form element, where the path to save the file is indicated. Included with AutoIT is a program called AutoIT Window Info, through which you can find out how the form elements are called:

The field we need is called “ComboBox1”, in order to access it, it was required to know the name of the window (Title) in which the element is located. In our case, the name of the window is as follows:
«Avatar.2009.Extended.Collectors.Cut (1080p) .mkv - Add a new torrent»
Since the name of the torrent file and the name with which it is added by default in the torrent client are two different things. And I just needed the name with which it is added by default. It was necessary to pull it out of the torrent file. From the information received, it followed that the torrent file was encoded in Bencode format, I did not find the library written for AutoIT, so I subsequently took it apart by simple reading. I needed the value of the name field. In our example, a piece of the file with the value I need looked like this:
"Name46: Avatar.2009.Extended.Collectors.Cut (1080p) .mkv12: piece"
What is 12: piece and why it was found in all the files that I viewed on my home computer, I did not understand. But since it is equally calmly called “Avatar.2009.Extended.Collectors.Cut (1080p) .mkv”. Now we can get the name of the window in which the “ComboBox1” element is located. The file name is taken from the name of the torrent, i.e. when saving the torrent file indicated the name "Avatar.torrent". Specifying a field value for a form in AutoIT is done as follows:
ControlSetText($Title, "", "ComboBox1", $NameTorrent)
We also send the command Left click of the mouse on the Ok button.
ControlClick ($Title, "", "Button7")
Voila torrent was added with the name I need in the directory I need on my home computer.
It is also better in uTorrent Settings -> Interface to uncheck the “Activate program window” box so that the addition of the torrent does not happen noticeably to the person who worked on the DC.
Fourth point
Everything is simple with him. We write to the log which is in the Dropbox folder about adding a torrent. In order to write about the completion of downloading a torrent, you must do the following. Go to utorrent settings → Advanced → Run this program after the end of the torrent indicated its program with the parameters TorrentBot.exe% F -onlylog.
System in operation
A program is running on the home computer (TorrentBot.exe). And let's say at work, I save the torrent to the Dropbox \ DWND \ 1_Films \ Cowboys vs. Aliens.torrent folder, the file is copied to the home computer with Dropbox, then the torrent is added to the download, and removed from the Dropbox.
Sources
The source code of the program is attached, I ask the code is not strictly judge.
For those who want to run the program. When you first run the exe file, config.ini is created in the same folder as the program. It is necessary to indicate the following:
[options]
PathDWND=G:\DWND\
PathDropBox=G:\Dropbox\DWND\
TimeUpdate=30
Where PathDWND is the path on your home computer where you need to save all downloads;
PathDropBox - the path in the Dropbox folder in which the folder structure from the PathDWND path will be located;
TimeUpdate - the time to check the appearance of new torrent files in the PathDropBox folder (in seconds)
Mandatory requirement do not confuse PathDWND and PathDropBox in places; otherwise, the PathDWND folder will contain only the structure from the PathDropBox, and
all files that were previously in PathDWND will disappear .
Oh yeah, use at your own risk.
Thanks for attention.
Used literature: help utorrent, help AutoIt, Google search.
TorrentBot.au3 .