1

I'll be doing the following task for literally thousands of times in the next days. It is part of a series of tasks that are subjective and cannot be automated, but this one can, I find it the most exhausting.

Can I automate the following and how:

  • Whenever the 'Download file info' pop-up window of IDM appears, change the text between the format text (.mp3) and the first slash from the right with text from the clipboard (see picture). Thank you.

enter image description here

EasternRiver
  • 153
  • 7
  • Thank you, but I found it complicated. I wonder if it can do the task every time I choose to download a file without me having to launch it again. If not, I'll be just wasting more time and energy. I'll be thankful if you can provide an answer showing how I can use it for this task. – EasternRiver Feb 28 '18 at 15:53
  • Thank you for the reply. As I mentioned in the question ("pop-up window of IDM"), it is the Internet Download Manager, 6.30 build 3. – EasternRiver Feb 28 '18 at 16:53
  • 1
    I assume you want to be able to change the name of the file from the Save As field and you want to change the name of the file only. You know what the full path to that will be and you know what the file extension type will be too. After you copy from the clipboard and as soon as there is a Download File Info window activated you want to immediately take the clipboard copied data and make that the file name and then press Start Download from the Download File Info window. I will be testing with this so tell me if I misunderstand you otherwise. – Vomit IT - Chunky Mess Style Mar 01 '18 at 04:25

1 Answers1

1

So on Windows you want some automation to. . .

  1. Detect when a specific window is spawned
  2. Make a specific detected window active
  3. Insert a full file path into a particular field within a specific window with the file name minus the extension of that path being the current clipboard's copied value

Consider using the free AutoIT application and some functions and loop calling methods for this.

AutoIT Logic

This method requires setting two variables: the full file path as $SavePath and the file extension as $SaveExt where the Save As field of the Download File Info window will save files.

This method sets a Local variable within the user-defined function labeled IDM_DFI() and copies the current clipboard's value as its value so it's assumed here that you will likely have something that copies a unique value to the clipboard before the Download File Info window is launched.

This process will select and delete everything from the Save As field, replace that with the $SavePath, $Clip, and $SaveExt variable values concatenated in that order becoming the string for the full file path and file name of the downloaded file saved, and then press Start Download.

This process starts with a CheckWin() user-defined function call and within that the WinWait function is used to wait for a window to spawn that has a title matching the value of the $WinTitle Global variable. When it detects this window it will perform the aforementioned processes and then call the CheckWin() function again and wait for another $WinTitle window to spawn.

Global $WinTitle = "Download File Info"
Global $SavePath = "F:\German lge\Audio database\"
Global $SaveExt = ".mp3"

CheckWin()

Func CheckWin()
   WinWait($WinTitle)
   IDM_DFI()
EndFunc

Func IDM_DFI()
   Local $Clip = ClipGet()
   WinActivate($WinTitle)
   Sleep(200)
   ControlSend($WinTitle, "", "[CLASSNN:Edit3]", "^a{DELETE}"&$SavePath&$Clip&$SaveExt) ; "^a" --> CTRL+a to select all
   Sleep(200)
   ControlClick($WinTitle, "", "[CLASSNN:Button1]", "left")
   Sleep(500)
   CheckWin()
EndFunc

It's possible to make this logic more dynamic to accept three input parameters and then you could pass those to the executable once it's compiled for the Window Title, Full Save As Folder Path, and the Save As File Extension which you want it to process (e.g. IDM_DFI.exe "Download File Info" "F:\German lge\Audio database\" ".mp3").


Further Resources

  • 1
    I put it in the SciTE Script Editor, saved the file and started using it. This is exactly what I want, and it works perfectly. I will learn more on the program for future automations. Thank you very much. – EasternRiver Mar 01 '18 at 10:14
  • I just want to ask whether you know of a solution to the ControlSend function sometimes sending missing characters, that is, at the end of the task, the file name has missing characters. I tried to detected a pattern of the kind of characters missing, but it seems random. There are some online discussions about this bug, but couldn't find a solution, e.g., www.autoitscript.com/forum/topic/131041-problem-with-send-cutting-off-characters/ – EasternRiver Mar 03 '18 at 14:50
  • I answer your first question with 'yes'. By missing characters, I mean when I check the file in the folder or in the list of IDM downloads, the name has missing letters. This is an actual example: instead of 'Kummer machen.mp3' I found 'ummer machen.mp'. The missing letters do not occur in these same places always. If I repeat with the same file and same name after deleting the data from the folder and IDM, the error may or may not occur. I'm always saving to one folder and no sub-folders. – EasternRiver Mar 03 '18 at 18:38
  • I wish I could add something to the code that makes sure the file name corresponds to what's in the clipboard. I need to get every individual file done each time I download the file not later collectively rename them, because I immediately use that single file (with the right naming) before I move to the next. Please note that the clipboard data is correct; sometimes missing letters are in the middle. – EasternRiver Mar 03 '18 at 18:41