Let’s say you have your daily reports and you have to merge them all in one single document in order to send it to your boss! But a daily report would mean approx 20 reports per month, so you would have to open each window, select everything within the document, copy it, switch to your new document that will contain all the merged files once you are done and paste it there, and also close the file you just copied and also you need to make sure you will not copy the contents of a file more than once!
Boring and it will take tooooo much time off my busy schedule…!
So, to start with, we tell WinAutomation where we have the folder that contains all these files. I have told it it’s on my desktop. We also make sure we inform it of the document we want to store all this information into, and also, set the folder that we want to move each file, whose content has been copied into our new document!
We open the Document we want to send the new information into, we’ll call it “my docs merged.doc” from now on, and then create a loop for each file within the folder we have our daily reports in (sorted by name or date modified or date created depending on what we want to use as a criteria to set the order in which the files will be copied in “my docs merged.doc”.)

And we tell our Job to open each file (each daily review) within the folder, and send the keys to select all, copy and then close the current file which is open. Focus on the “my docs merged.doc” and paste the information it previously got.
I also wished to keep the name of the file I got the content from as a title along with the created date of the file, and also decided to play about with the formatting of this information (display the folder name and created time in bold and also underlined), so using delays between the keystrokes I also sent in some formatting of what I set to be the title of each pasted content.
%CurrentItem.NameWithoutExtension% - %CurrentItem.CreationTime% > gets the file's name and also the date the file was created and it inserts the information as text within the document
{Shift}({Home}) > once in the document if we press shift+home takes us from where we are to the beggining of the line and it selects this text, in our case, the filename and the creation date of the file
{Delay 100}{Control}({B}) > we need to add some delay cause depending on how much text it will select, after that long it will have to send the keys to make the selected text bold
{Delay 200}{Control}({U}) > same applies with control B, but we also have to take into account the previous keystroke sent
{End}> we then deselect everything by going to the end of the row
{Control}({B}){Delay 200}{Control}({U}) > we need to tell it to stop making any text from this point on bold or underlined
{Enter} > we leave a space between what we have set to be our title and our main content
{Control}({V}) > we paste the content we got from the current file we had opened

If I did not send in delays between the keystrokes, it would process the key strokes faster than needed and then I would not get the desired result.
(for more infromation on delays you can check out "Manage the delays between keystrokes")
Having finished and copied the content of the file, I tell the Job to move the file to a folder so that I know which files I have already merged and which are still to be merged.

Same applies for any sort of archives you may have and you definitely need to make a single document of.

Post new comment