Are you documenting a program or new functionality, writing an article or collecting material for a presentation? If yes, you probably have to insert a lot of graphics into the text, and for the most part, various screenshots.
If the amount of work is small, the efforts you make to capture screenshots are not significant. But if you have to make more than 3-5 pictures, it makes sense to make things easier.
Let's see how AutomationBox Tools free automation utulities can be used to automate the process of taking screenshots of windows, their parts or arbitrary control elements.
How many actions are you repeat each time you take a screenshot?
First, let's find out what actions you repeat each time you make a screenshot:
- Make a screen copy using the PrtScr (the entire screen) or Alt+PrtScr (active window) keys
- Insert the image into the graphic editor
- Cut the unnecessary areas of the image
- Save the picture into a file. The filename usually includes the name of the window or control element, which is captured in the image
AutomationBox Tools free automation utilities automate this steps
Now let's see how AutomationBox Tools can be used to automate these steps.
To select windows and control elements, you can use the abtcapture utilitity with the --manualselect parameter. It is also can determine name, position and size of the selected objects.
To create screenshots, you can use the abtscrshot utility, also a part of AutomationBox Tools.
All we have to do is to combine them in such a way that after the object is selected, its name, size and position were passed to abtscrshot as the filename and screen area.
Since AutomationBox Tools work from command line, they can be easily combined. In this particular case, let's use the abtcapture --execute parameter, which allows running an arbitrary command after the object is selected.
Information about the selected object can be passed using the environment variables ABT_* (the full list is given in the "Environment variables" chapter).
To make a loop, we write a simple command file (.cmd).
The created screenshots will be saved in the screenshots subdirectory.
abtcapture --manualselect --execute^
"abtscrshot '.\screenshots\%%ABT_FRIENDLYNAME%%.png' --area %%ABT_SCREENRECT%%"
if %ERRORLEVEL% equ 0 goto GO
The first line creates the screenshots directory.
The second line contain a conditional branch label, to which we will return after the screenshot is successfully created.
The third line contains a call to abtcapture --manualselect to select the object in the screen.
The --execute parameter specifies that after the object is selected, the abtscrshot command will be launched with the composite object name passed as the filename parameter (it automatically substitutes for %%ABT_FRIENDLYNAME%% before launching abtscrshot).
The last line checks the execution result and if all went well (the return code = 0), proceeds to the GO label.
Now simply launch scrshot.cmd and you will only have to point the mouse to the necessary object and press Ctrl to create a screenshot or Esc to stop "photographing". The created screenshots will be automatically placed tot he screenshots directory.