Using Controls
Let's go through an example of how to use the Window Controls. To begin, let's run the Windows calculator. (To run the calculator, click on Start | Run from the bottom left of the computer screen, enter calc and click the OK button.) Leave the program running and return to Macro Express.
We'll create a macro using a hot key. From the Macro Express Explorer menu click on Macros | Add Macro. A new window should appear titled Add Macro. Hot Key should already be selected and the blinking cursor should be in the edit box. If the cursor is not in the edit box, click on the edit box with the mouse to place it there.
Next, press the F3 key and then release it. F3 should appear in the edit box. This is the hot key we will define for the macro. We can choose to create the macro by entering the macro command directly, by using the scripting editor or capturing the macro. For this exercise click on the Scripting Editor button to activate the Scripting Editor.
In the Scripting Editor first click on the Properties tab. In the Nickname box, enter "Clear Calculator". Then click on the Scope tab and make sure Global is selected. Now click on the Script tab to return to the screen displayed above. Scroll down the list of commands and click on the Window Controls command to expand this listing. Double click on the Get Control command found in this group.
This activates the Get Control window. Place a check in the box next to Hide Macro Express. Make sure that the Save Control In variable is set to C1 and select Exact Match. Now click on the Launch Get Control Utility.
This activates the Capture Window Control screen and hides Macro Express. Now click on the target (crosshairs) at the bottom of this window. Hold down the left mouse button and drag it over top of the "C" button on the calculator. Release the mouse button. This should insert some information into the Capture Window Control. Class Name should read "Button" and Window Text will be blank. Click the save button to save the information and return to the Get Control Window.
This window should have the information stored to the variable C1 as shown above. Click OK to save this command and return to the Scripting Editor. Scroll down the list of commands and click on the Window Controls command to expand this listing (if not already open). Double click on the Mouse Click on Control command to open the Mouse Click on Control window.
In the General Tab, select Single Click, C1 as the variable and Left Button. This instructs the macro to perform a single left mouse click on the variable C1, which we have defined as the "C" button on the Calculator. We can ignore the Advanced Tab, so click OK to save your changes. This returns us to the Scripting Editor. The script should look like the following:
Get Control %C1%
Mouse Single Left Click on Control %C1%
Click on File | Save to save the macro and return to the Macro Explorer. Our F3 macro with a nickname of Clear Calculator should now be listed in this window.
Now let's test out the macro. Run the calculator program. (If you closed the program, click on Start | Run from the bottom left of the computer screen, enter calc and click the OK button.) Enter some numbers into the calculator. With numbers displayed in the Calculator edit box, press the F3 button. This simulates clicking on the C button of the calculator and clears the display.