Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically taking screenshots of program window

I'm looking for a software that combines macro recording with screenshot taking capabilities.

We have a software manual with a number of screenshots. When new version of software is released we need to update most of screenshots and we have to do it manually. Now we started translating manual to several languages and number of screenshots to take have increased ten fold. We'd like to automate this process.

There will be a recorded macro or something that clicks button within our software and takes screenshots of the program window. Better yet, we can specify the name of each screenshot individually though it's less important.

Does such a thing exist?

like image 889
Sergey Kornilov Avatar asked Jan 20 '11 19:01

Sergey Kornilov


People also ask

Can we automate taking screenshots?

This way you can automate the entire screenshot capturing process: start your application with Run. select each of your menu options with Send. complete each screen's data also with Send.


6 Answers

I use AutoIt plus captdll.dll for all my Windows GUI automation tasks.

Example:

Run("Notepad.exe", @WindowsDir, @SW_MAXIMIZE)   ; Open NOTEPAD
Sleep(1000)
Send("Just a Test")   ; Send some text to notepad

; Save the screen to test.jpg  
$anPos = WinGetClientSize("")
$nLeft = 0
$nTop = 0
$nRight = $anPos[0]
$nBottom = $anPos[1]

$sFileName = "test.jpg"
DllCall("captdll.dll", "int:cdecl", "CaptureScreen", "str", $sFileName, "int", 85)

This way you can automate the entire screenshot capturing process:

  • start your application with Run
  • select each of your menu options with Send
  • complete each screen's data also with Send
  • capture with DllCall("captdll.dll" ....)

You can also add conditional logic, loop, etc.

like image 108
PabloG Avatar answered Sep 28 '22 22:09

PabloG


Yes. You want automated testing software, which can do all this and test your product too.

http://en.wikipedia.org/wiki/List_of_GUI_testing_tools

like image 27
Ben Avatar answered Oct 02 '22 22:10

Ben


Testing Anywhere seems to have the functionality you need. Some words from their website:

"Powerful GUI based recording capabilities and a no-programming required user interface allows testers to quickly set up even complex test cases" ...

"Visual log reports: Testing Anywhere’s powerful Visualize option takes screenshots to create visual logs during runtime." (see here)

You could also try something more simple and (cheaper!) such as Jitbit Macro Recorder that let's you play back recorded macro's (keyboard and mouse) and then use the Shift-PrintScreen key in the macro to make screenshots. It also has a macro script editor.

like image 28
Peladao Avatar answered Sep 29 '22 22:09

Peladao


If it's a webapp you can use Selenium. There is a similar tools for Visual Studio's called Test Automation FX

like image 35
jpiasetz Avatar answered Sep 28 '22 22:09

jpiasetz


Yoiu can look into existing Windows Automation API : UI Automation, MSDN documentation

Run-Time Requirements

UI Automation is supported on the following operating systems: Windows XP, Windows Server 2003, Windows Server 2003 R2, Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2.

Client applications, from simple test scripts to robust record and playback utilities, may require access to elements that are not currently instantiated, such as a file open dialog or a menu item and therefore do not exist in the UI Automation tree. These elements can only be instantiated by reproducing, or "playing back", a specific sequence of user interface (UI) actions through the use of UI Automation properties such as AutomationID, control patterns and event listeners. See Test Script Generator Sample for an example that uses Microsoft UI Automation to generate test scripts based on user interaction with the user interface (UI).

You can use AutomationIdProperty inside existing Visual Studio project.

Implementing UI Automation in a Test Application

  • Add the UI Automation References.

The UI Automation dll's necessary for UI Automation clients are listed here.

UIAutomationClient.dll provides access to the UI Automation client-side APIs.

UIAutomationClientSideProvider.dll provides the ability to automate Win32 controls. See UI Automation Support for Standard Controls.

UIAutomationTypes.dll provides access to the specific types defined in UI Automation.

  • Add the System.Windows.Automation namespace.

This namespace contains everything UI Automation clients need to use the capabilities of UI Automation except text handling.

  • Add the System.Windows.Automation.Text namespace.

This namespace contains everything a UI Automation clients need to use the capabilities of UI Automation text handling.

  • Find controls of interest

Automated test scripts locate UI Automation elements that represent controls of interest within the automation tree.

There are multiple ways to obtain UI Automation elements with code.

Query the UI using a Condition statement. This is typically where the language-neutral AutomationIdProperty is used. Note An AutomationIdProperty can be obtained using a tool such as UISpy.exe (UI Spy) that is able to itemize the UI Automation properties of a control.

Use the TreeWalker class to traverse the entire UI Automation tree or a subset thereof.

Track focus.

Use the hWnd of the control.

Use screen location, such as the location of the mouse cursor.

See Obtaining UI Automation Elements

  • Obtain Control Patterns

Control patterns expose common behaviors for functionally similar controls.

After locating the controls that require testing, automated test scripts obtain the control patterns of interest from those UI Automation elements. For example, the InvokePattern control pattern for typical button functionality or the WindowPattern control pattern for window functionality.

See UI Automation Control Patterns Overview.

  • Automate the UI

Automated test scripts can now control any UI of interest from a UI framework using the information and functionality exposed by the UI Automation control patterns.

Related Tools and Technologies

There are a number of related tools and technologies that support automated testing with UI Automation.

UISpy.exe (UI Spy) is a graphical user interface (GUI) application that can be used to gather UI Automation information for both provider and client development and debugging. UI Spy is included in the Windows Software Development Kit (SDK).

UIAutoCmd is a command-line tool with capabilities similar to UI Spy.

MSAABridge exposes UI Automation information to Active Accessibility clients. The primary goal of bridging UI Automation to Active Accessibility is to allow existing Active Accessibility clients the ability to interact with any framework that has implemented UI Automation. Security

For security information, see UI Automation Security Overview.

like image 30
Artur Mustafin Avatar answered Sep 30 '22 22:09

Artur Mustafin


I've tried many and the one that really stands out, in my opinion, is Adobe (formerly Macromedia) Captivate. It's atrociously expensive (~800$) but worth every penny.

Creating tutorials etc. takes minutes instead of hours.

like image 22
smirkingman Avatar answered Sep 30 '22 22:09

smirkingman