Capturing Data in a Windows Application
Using Recording mode or the WinTask x64 Capture Wizard (menu item Start/Capture Wizard), you can easily retrieve data displayed in a window belonging to a Windows application (see Capturing data in a Web page for retrieving data displayed in a browser).
Video: How to capture data displayed in a Windows application
The following steps illustrate how to capture a text typed previously in Notepad.
Start WinTask x64. If the Your First Script Wizard dialog box is displayed, click the Close button. The WinTask x64 Editor window should now be active.
From the WinTask x64 toolbar, click the Rec button to start recording your actions.
The Start Recording Mode dialog box will appear asking What do you want to start before recording?. Select the An application radio button and click the OK button.
In the following dialog box, Launching a program, type notepad into the Program text field and click the OK button.
When the notepad window is loaded, type some text:
Here is the line 1
Here is the line 2
Here is the line 3.
After you have typed the 3 lines above, click the Capture icon on the floating WinTask x64 toolbar. The Capture button is the third button from the left on the toolbar with the "T and magic wand" icon.
The first screen of the Capture Wizard subtitled Specify the window where the data to be captured are is displayed. Click the Spy button. The mouse cursor changes to a "Crosshair within a circle". Move the cursor over the area where you have typed text. When you see the selection rectangle around the table, click the left mouse button to capture the data within the notepad window.
Press the Next button.
The screen subtitled Take only some of the captured data is displayed. Use this screen to capture only a part of the captured text.
Uncheck The beginning and The end checkboxex. Select line 1 word and copy it, then paste it in the Between field. Select 2 word and copy it, then paste it in the and field. Click Show extracted data button to see the results:
Click the Next button. The screen subtitled Specify where to copy the captured data is displayed. Change the variable name storing the captured data in a simple one, type var$ in Variable name field.
Click Paste into the script button.
Stop Recording Mode by clicking the Stop button on the floating WinTask x64 toolbar. The Stop button is the first button on the left side of the toolbar with the "X and rectangle" icon.
The WinTask x64 Editor window is now restored and the script statements generated during Recording Mode are inserted into the current script document window.
To see the results of the capture at replay, add at the end of the script a msgbox statement displaying var$
Click icon to execute the script. You are prompted for a name, call the script for example capture. After the script runs to completion, the captured data is displayed, click the OK button of the dialog box.
'The steps above were used to generate the following script statements. Comments have been added to explain each script statement.
'Type text in notepad window
UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1)
SendKeys("Here is the line 1<Enter>")
SendKeys("Here is the line 2<Enter>")
SendKeys("Here is the line 3")
'Capture the text displayed in the notepad window and extract only a part of it
captured_string$ = Capture$("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1,1)
var$ = ExtractBetween$(captured_string$,"line 1",excluded,"2",excluded)
'Close notepad window without saving
CloseWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",1)
'Display the result of the capture