WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

!A look at RoboScripter


RoboScripter is a little utility, sort of in the macro recorder genre, that was designed to make Control Manager scripts much easier to write.

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.


Recording/Playback products have long been a popular way to automate repetitive processes on a computer. However in the Windows environment the simple recording and playback of user keystrokes and mouse movements leaves much to be desired. In perfect conditions, such recorded processes may work well, but often conditions are not perfect.

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.

Step 1:

Run the RoboScripter.

To launch RoboScripter select
Start | Programs | WinBatch | RoboScrp.w32

Step 2:
You will then be prompted to run the program you want to automate.

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.

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 which allows you to type the appropriate keystrokes.

Type: !fo
for Alt-File-Open

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.

Step 5:
Now that the Notepad '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 which allows you to type the file path.

Type the name of an existing file
(i.e., 'c:\autoexec.bat')

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.

Step 6:
Next, drag and drop the 'Select Window' cross-hairs on the 'Open' button control.

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.

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.

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 ;;;;;;;;;;;;;;;;;;;;;;;;

; Made with 
;   RoboScripter ver: 28
;   CtlMgr ver: 20025

;Launch Program

;Title: Untitled - Notepad
;ID: 3148
;Class: Notepad
;Level: 1
cSetFocus(ControlHandle)  ; Activates Window
SendKey(`!fo`)     ;Sends Keystrokes

;ID: 1152
;Class: Edit
;Level: 2

;Title: &Open
;ID: 1
;Class: Button0
;Level: 2

;;;;;;;;;;;;;;; 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.


Except for very simple applications, RoboScripter probably will not be able to write the exact script you need. However it can get close and do much of the heavy lifting required to successfully use Control Manager based scripts.

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.

  1. Any time your script causes a new window to appear, it is recommended that you add a WinWaitExist to wait for the new window to appear before continuing.

  2. Some applications need a DirChange to a desired "working" or "Start In" directory before being run. In this case add


    before the RUN statement in your script.

  3. RoboScripter is unable to record the click on a top-level menu item and a subsequent click on a drop down menu item.

    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.

  4. The full power of the Control Manager extender is not currently supported by RoboScripter. In addition, you may encounter strange Window or control types that confuse RoboScripter.

    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