PC Automation
I wanted an invite to Habr ( thanks to the Nast user for the invite ), and finally this fact became the engine for writing an article that is based on the history of personal experience in the field of automation of tasks related to PCs.
I am an automation engineer, I love that most tasks (software, hardware) would be executed automatically without the intervention of me or other people.
Goal:
- To tell and, possibly, teach to optimize the work on the PC.
- Anyone who was looking for such information will have the knowledge to start and develop the task optimizer.
- To give an additional opportunity to overcome laziness, and to do something really useful for oneself and others.
- Show, an example, how to make a program that automatically executes a recorded algorithm of actions for your convenience.
- To prove that automation is not tedious, but as a result it is useful and even very interesting.
Reasons:
First. I often come across the fact that most users do not know how to organize their working hours, specifically on a PC. It is ridiculous to watch when the user is distracted, from really expensively paid work, at small software (sometimes hardware) actions, and then indignantly looks at the boss, who, this month, reduced the premium for poor performance relative to previous results.
Secondly. Before, I often had routine tasks that I had to automatically execute using various software products. But no matter how many software options exist, there are always functions that are not so easy to execute in one package. And I had to use several automation programs in combination with programs for the standard purpose of office or not-so-office work.
Thirdly. The time has come when a real routine task appeared. It was connected with the fact that it was necessary to extract text, tables, images from a PDF file, with protection against copying, recognition by any software, printing, and something else installed on it. In general, the author of the file put the maximum protection in a certain (I can’t even remember) program for creating PDF files. Yes, and another important point, the pages in the file 202, the background is blue, and the text is sometimes yellow, sometimes blue. And most importantly, the deadlines for receiving the finished text are only 3 days. I sometimes suffer from laziness, therefore, I immediately discarded all physical labor, and also, I did not begin to look for a team of a dozen lovers of manually typing text from a picture. As always, I turned to software products for automating tasks.
But not everything is as simple as it seems at first glance. I have already said above that with one program you can perform a maximum of 99.9% of the required work. So I began to search the Internet and use in turn the most fashionable, by rating and reviews, automation programs, of course, provided that, firstly, they could perform the functions I needed in the GUI environment, and not in the console, and secondly, free. Yes, by the way, we are talking about Win-applications. I will not recommend which application is better and which is worse - you can try it yourself yourself, for your goals and convenience habits. In principle, I can automate on BASIC better than any special program for this business, but I didn’t want to install Visual Studio - it is a waste of time and space on my hard drive. Moreover, we need a program that already has all the options for controlling a PC, where you just need to select all the necessary actions from the list and change several parameters for yourself. And for a typical user, this is exactly what is required, there is no need to learn programming languages, everything should already be created in advance and work.
So here. He opted for the xStarter program(at that time v.1.9.2). Approached 90%. I will not praise, I will only say that the application really has a very convenient environment for the wide implementation of the automation algorithm. The only bad thing is that some functions are not configured, for example, the screen screenshot function loses quality due to compression - it is not suitable for text recognition. And I didn’t like the fact that there is no separate window that would show the coordinates of the mouse cursor, I had to download the gadget for the sidebar in Vista “Mouse Pointer Locator”. And, of course, the third is not very important as for an advanced user, but what is needed in some contentious issues is a reference to the application’s functionality. It feels like the help file is from the old version, and there is only part of the functionality in the description.
At the time of writing, checked the new versionxStarter v.1.9.3 - the help file is now complete, there are sights for determining the start and end points of the cursor on the screen, and the quality of the screen shot has improved markedly, now the text can be recognized. Well done guys! I will be happy to wait for new releases of this program, where I will get even more functionality.
And I implemented the PDF file recognition algorithm (with Protection) is very simple:
- Full Screen PDF
- Screenshot “Print Screen”
- Paste in “Photoshop”
- Cycle up to page 202
- Macro in “Photoshop”: crop, save
- The folder with pictures in “Fine Reader”
Handmade:
- Manually, text analysis and error correction.
- Saving in “Word”
- DOC file editing
Using the time of individual tasks:
- Creation of an automation algorithm - 25-30 minutes.
- Algorithm setup - 30-60 minutes.
- Recognition and editing of the text - 4-5 hours.
Total time use:
- With automation (1 person only edits the text, the rest is automatic.) - 5-7 hours.
- Without automation (1 person does everything manually) - 3-5 days.
Practical example: (not about what was written just above!)
I’ll show you not just an example of “Hello World” type, I’ll show you how to create a bot (that is, an automation algorithm) for the game “Factory of Friends” on vkontakte .ru
I was attracted to this game precisely by the fact that it is possible to win virtual money in it using a bot, despite the fact that the game works in a browser and is a Flash object. I do not have competence in flash-technologies, therefore, specially formulated requests for managing a game without a browser (if there are such at all?), I immediately threw it aside, my bot will use only the mouse cursor specifically for the game, and several more functions for managing browser, screenshot, variables, loops, and nothing else is needed.
And so, let's start, in the picture the appearance of the program : The

bot consists of 2 tasks:
- “Friends Factory - Purchase (Firefox)” is the main bot algorithm. 'Firefox' is simply a browser designation of how the algorithm will work. You can adjust to any.
- "Read_Compare_ff" is an additional algorithm for checking the image on the fact of its change.
The bot algorithm does the following:
- Finds a browser window with the game running and opens it in full screen.
- Next, the 2nd task is launched, which takes a picture of the screen area, exactly in the place where the figure with the amount of money in the game is located.
- Now the bot should hover, and click on the "Nursery" button next to "Everything" and buy the first pet that comes across.
- When the pet is purchased, the amount of money decreases - this is checked by our 2nd task according to claim 2.
- If there are no pets at all in the nursery “Everything” (often happens), then repeat step 3 endlessly.
- After the purchase, the bot, after a while checks (item 2) the fact of the sale of the pet - that is, an increase in the amount of money.
- If the pet is sold, then the bot repeats step 3; if it is not sold, then the bot clicks the Nursery button to update the game result, an infinite number of times.
This is a general description of the operation of the algorithm that I made for my purposes, and I use it even now. The first was a bot to visit the game every 2 hours, but it gave much less profit in the game than the 2nd. It’s good to leave the bot working while you are away at the PC.
Download bot (2 tasks) for xStarter program
And finally ...
Automation pros:
- Increase productivity with a PC (primarily for repetitive tasks).
- There is more time for relaxation or other activities.
- Overcoming the threshold of initial laziness, that is, the intention to make an algorithm to facilitate its own existence.
- Usefulness for personal use.
- Additional knowledge of technology is only beneficial.
Cons of automation:
- People do not want to learn and develop, they are happy to do what they have been doing for decades. Laziness prevails!
- People are afraid to do work faster, since the boss will immediately fill up with more additional work. Again, laziness is higher than premium!
- People
from schoolare taught to work, not to earn!
Bottom line:
I want this article to help at least someone develop in the field of process automation. And that everyone who indirectly relates to this article would express their subjective opinion about the information read. Well, and of course I