This 'RoboScripter Tutorial' is intended to be a step by step guide to aid in the understanding of how the Control Manager Extender and the RoboScripter, are used to generate code for a WIL script. How to enter text into an EditBox control
This tutorial is going to teach you how to write text into the EditBox (control) of Notepad's 'File | Open' dialog.
Step 1:Run the RoboScripter. To launch RoboScripter select 'Start Menu | Programs | WinBatch | RoboScrp w32…'
Step 2:You will then be prompted to run the program you want to automate.
Note: You do not have to select any application. If you choose not to press Cancel, in this dialog.
Locate Notepad.exe in your Windows directory, then press 'Open'. At this point Notepad and RoboScripter should be launched and on the screen. (if not, please repeat steps 1 and 2)
The following is an example RoboScripter dialog. Click on the controls in the dialog for pop-up help.
Step 3:Now that Notepad is launched and on the screen, we need to bring up the 'File | Open' dialog. This can be done, by dragging the 'Select Window' cross-hair control over the Notepad window's title bar.
Step 4:You will then see a set of 'actions' appear in the RoboScripter Dialog. Select the SendKey radio button. An edit control will appear, that allows you to type the appropriate keystrokes.
Type: !fo
Press the 'Perform' button to perform the operation specified.
At this point you should see a dialog, with the window title 'Open' on the screen. (if not, please repeat all previous steps)
Step 5:Now that Notepad's 'Open' dialog is on the screen, drag and drop the 'Select Window' cross-hairs on the 'File name' editbox control. You will then see a set of 'actions' appear in the RoboScripter Dialog. Select the cSetEditText radio button. An Edit control will appear in the RoboScripter dialog, that allows you to type the file path. Type the name of an existing file (i.e., 'c:\Program Files (x86)\WinBatch\The list of fixes and improvements.txt')
Type: c:\Program Files (x86)\WinBatch\The list of fixes and improvements.txt
Press the 'Perform' button to perform the operation specified.
Step 6:Next, drag and drop the 'Select Window' cross-hairs on the title bar of the 'Open' dialog. You will then see a set of 'actions' appear in the RoboScripter Dialog. Select the SendKey radio button. An edit control will appear, that allows you to type the appropriate keystrokes.
Type: !o
Press the 'Perform' button to perform the operation specified.
At this point you should see the file loaded into Notepad. (if not, please repeat each previous step)
Step 7:We are nearing completion. Select the 'Paste' button on the RoboScripter Dialog. This will paste the buffered code into the Windows Clipboard. Next, select 'Quit', to close RoboScripter.
Step 8:Open Winbatch Studio.exe, then open a new file.
Type: ctrl-v
This will paste the buffered code into your WinBatch script.
|
What is the Control Manager Extender? Overview of Control Manager Usage
|
Completed script
;RoboScripter ; Made with ; RoboScripter ver: 45 ; CtlMgr ver: 44039 AddExtender("wwctl44i.dll")
;Launch Program Run("C:\Windows\notepad.exe","")
;Title: Untitled - Notepad ;ID: 7080339 ;Class: Notepad ;Level: 1 ; Default cWndByWndSpec seems OK here ControlHandle=cWndByWndSpec("Notepad","notepad",2,15,1025) cSetFocus(ControlHandle) ; Activates Window TimeDelay(1) SendKey(`!fo`) ;Sends Keystrokes
;Title: <untitled> ;ID: 1148 ;Class: Edit ;Level: 4 ; Default cWndByWndSpec seems OK here window1=cWndByWndSpec("#32770","notepad",13,0,1090,1148,1089,1136,0,0,1,2,-1,1092,1091,1093) window2=cWndByID(window1,1148) window3=cWndByID(window2,1148) ControlHandle=cWndByID(window3,1148) cSetEditText(ControlHandle,`C:\Program Files (x86)\WinBatch\The list of fixes and improvements.txt`)
;Title: Open ;ID: 0 ;Class: #32770 ;Level: 1 ; Default cWndByWndSpec seems OK here ControlHandle=cWndByWndSpec("#32770","notepad",13,0,1090,1148,1089,1136,0,0,1,2,-1,1092,1091,1093) cSetFocus(ControlHandle) ; Activates Window TimeDelay(1)
SendKey(`!o`) ;Sends Keystrokes
|
You will note that the generated script begins to look familiar as you progress through an application. At the top there is a small block of comments that identify what version of RoboScripter made the script and what version of the Control Manager extender was found on your system. Then it does the obligatory AddExtender of the Control manager extender DLL. This is followed by an optional block which simply launches the application exe file that you wish to test. All the following blocks have the same general format. First a cWndByWndSpec function is used to obtain a top level window handle, and this is followed by some number of additional Control Manager functions to burrow down to the exact window or control that you are interested in. This is where most of the power of RoboScripter comes in. It can figure out how to burrow down to the desired window. Then, at the end of each of these blocks is the selected Control Manager (or other) function that affects the item that we finally burrowed down to.
|