Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Due to the success people have been having, the Control manager extender and RoboScripter have been incorporated into the standard WinBatch install, as opposed to being an add-on extender that had to be installed separately.
This article consists of a quick look at RoboScripter.
The main problem is the nature of record/playback software. It does just that. Blindly records user actions and plays them back, without any knowledge of the intent of the user.
The holy grail of this sort of activity is to divine the actual intent of the user, and perform that intent, as opposed to simply blindly sending keystrokes and mouse movements.
It is deemed difficult, if not impossible, to determine the effects that various keystrokes and mouse actions have in the Windows environment. It is simply too hard to see a keystroke or mouse click occur, then attempt to determine what windows event occurred as a result of that action. Thus keystroke/mouse recorder products are pretty much limited to just that, blindly sending keystrokes and mouse movements.
Taking a cue from industrial automation robots, which are led through a series of operations and can then reproduce those operations, we have developed RoboScripter.
RoboScripter is a kind of a small robot window that sits on top of your Windows screen. When you wish to perform some action, the idea is to grab some "crosshairs" with the mouse and drag the crosshairs to the exact place where you wish some action to be performed, then drop the crosshairs on the target.
RoboScripter will then analyze what is on the windows screen under the exact point where the crosshairs were dropped, determine what actions are possible, and suggest a number of possible actions that you may wish to perform.
By repeating this process, you can work through your application and complete the task. Then, by simply hitting the "PASTE" button, you can paste an entire script that replicates your actions to the clipboard.
To use RoboScripter, first you have to install it. The easiest way is to simply download WinBatch (or WinBatch+Compiler) 2001J or newer, unzip it into an empty directory and run the setup.exe file found therein.
After installation, there will be a RoboScrp.w32 on your START->Programs->WinBatch menu, along with a Consolidated WIL.chm which will now contain the the help file for the Control Manager extender: CtrlMgr.chm .
Truth be told, the Control Manager extender could do this work in previous versions of WinBatch, but due to the lack of RoboScripter in older versions it was a rather painful slog to make a Control Manager based script work, requiring inordinate amounts of the typical banging-your-head-against- the wall sort of activity. RoboScripter removes most all or the more painful elements and helps you write robust scripts.
In any case there is nothing like plodding through a real example to get a feel for how to use it. In the Control Manager help file (CtrlMgr.chm) has a better looking version of the text below, complete with a few pictures, but for now we'll deal with the text of the example and perhaps some vivid descriptions.
This 'RoboScripter Tutorial' is intended to be a step by step guide to aid in the understanding of how the Control Manager Extender and RoboScripter, are used to generate code for a WIL script and how to enter text into an EditBox control.
Run the RoboScripter.Step 2:
To launch RoboScripter select
Start | Programs | WinBatch | RoboScrp.w32
You will then be prompted to run the program you want to automate.Step 3:
Locate Notepad.exe in your windows directory, then press 'Open'. At this point Notepad should be launched and on the screen.
At the same time a RoboScripter window will pop up and remain on the top of all other windows until you close the RoboScripter program.
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 which allows you to type the appropriate keystrokes.Step 5:
Press the 'Perform' button to perform the operation specified. At this point you should see the Notepad File Open dialog, with the window title 'Open' on the screen.
Now that the Notepad 'Open' dialog is on the screen, drag and drop the 'Select Window' cross-hairs on the 'File name' editbox control.Step 6:
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 which allows you to type the file path.
Type the name of an existing file
Press the 'Perform' button to perform the operation specified. You will see that the filepath that you typed into RoboScripter placed into the FileOpen dialog.
Next, drag and drop the 'Select Window' cross-hairs on the 'Open' button control.Step 7:
You will then see a set of 'actions' appear in the RoboScripter Dialog.
Select the 'cClickButton' radio button.
Press the 'Perform' button to perform the operation specified.
At this point you should see the file loaded into Notepad.
We are nearing completion.Step 8:
Select the 'Paste' button on the RoboScripter Dialog. This will paste the buffered code into the Windows Clipboard.
Next, select 'Quit', to close RoboScripter.
Open WinBatch Studio.exe, then open a new file.
Type: ctrl-v This will paste the buffered code into your WinBatch script.
Now, you can close your Notepad window and test your new script.
The completed script is below. You will note that various obscure comments have been added, but as your understanding of the Control Manager extender grows, the comments may help you understand more of what is going on.
In addition there is a *just horrible* function called cWndByWndSpec. However this function was added in specially for RoboScripter to aid it in uniquely identifying windows. It is similar to the standard DllHwnd function, but it does a much better job of not confusing windows with the same title. However, since RoboScripter codes the function for you anyway, it may be best to just blink at it and move on to the more important tidbits of code.
;;;;;;;;;;;;;;; Begin sample script ;;;;;;;;;;;;;;;;;;;;;;;; ;RoboScripter ; Made with ; RoboScripter ver: 28 ; CtlMgr ver: 20025 AddExtender("wwctl34i.dll") ;Launch Program Run("C:\WINDOWS\Notepad.exe","") ;Title: Untitled - Notepad ;ID: 3148 ;Class: Notepad ;Level: 1 ControlHandle=cWndByWndSpec("Notepad","NOTEPAD",1,15) cSetFocus(ControlHandle) ; Activates Window TimeDelay(1) SendKey(`!fo`) ;Sends Keystrokes ;Title:
;ID: 1152 ;Class: Edit ;Level: 2 window1=cWndByWndSpec("#32770","NOTEPAD",13,1091,1137,1088,1120,1121,1090,1152,1089,1136,1040,1,2,1038) ControlHandle=cWndByID(window1,1152) cSetEditText(ControlHandle,`c:\autoexec.bat`) ;Title: &Open ;ID: 1 ;Class: Button0 ;Level: 2 window1=cWndByWndSpec("#32770","NOTEPAD",13,1091,1137,1088,1120,1121,1090,1152,1089,1136,1040,1,2,1038) ControlHandle=cWndByName(window1,`Open~`) cClickButton(ControlHandle) ;;;;;;;;;;;;;;; End sample script ;;;;;;;;;;;;;;;;;;;;;;;;;;;
You will note that the generated script begins to look boringly 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.
In using RoboScripter to write various scripts, a few points have been noticed, and by relating them to you, perhaps we can save you the time required to discover them yourself.
before the RUN statement in your script.
To select a menu item from an application, drag the crosshairs to the application title bar, then select the SENDKEY option to send the menu hot-key characters to the application instead.
In this case a good workaround is to drag the cross-hairs to the control and select the cSetFocus option, which will activate the control. Later you can edit the script to add special code there, SendKeys perhaps, to deal with the control.
Suggestions for improvements in RoboScripter, and indeed, for all our products are gratefully accepted.
Article ID: W14765
File Created: 2017:07:28:12:58:09
Last Updated: 2014:06:17:13:17:59