Command Capture

Top  Previous  Next

Command Capture is a way to spy on the inner workings of other applications and recreate some of the actions that happen inside. The Windows operating system internally uses messages to make all the user interaction happen. These messages have names like WM_LBUTTONDOWN, WM_COMMAND etc. These are not exposed to the end user and only happen behind the scenes. However with the use of command capture you can now catch those messages in real time and store them. Once captured you can then recreate them at any time.

 

Note that since we are grabbing deep into the inner workings of an application in an unexpected way things might not always work. Trial and error work best here.

Parameters

This action has 4 parameters plus targeting. The first 3 parameters you may set by hand but since these values are completely undocumented the only way to find out their value is by actually capturing the values. The last parameter is the choice between SendMessage and PostMessage. We suggest going with PostMessage. The reason for this is that PostMessage does not wait for the target application to process the message. SendMessage potentially blocks Girder until the remote app responds.

Capturing

Capturing messages is done by clicking on the "Capture..." button. This will show a dialog like the one below. Press "Start Capture" to actually start capturing the messages.

 

command_capture

Command Capture in progress

 

The dialog above shows what it looks like when you press the "7" button on the Windows Calculator. It generated 3 events. The first one is the mouse message and the last two are the actually WM_COMMAND that triggers the internal code to add a 7 to the display. Highlight one of them and press test to see if it works. For Windows 7 64 bit calculator any of them will work. For the application that you are trying to automate you might have to experiment a bit. Try by clicking the desired button, maybe try using the menu bar or shortcut keyboard action. Basically this is trial and error to find the right way to capture. Sometimes it's not possible to capture and you'll have to go with keyboard or mouse actions.