Clicking on a Control
This is an example of using Window Controls. The macro saves the Zoom button at the bottom of a WordPad window to a control variable. The macro then clicks on the control (button) several times to zoom in.
A copy of WordPad needs to be open. To do this type WordPad in the Type here to search field in the Task Bar and press Enter.
Select a Macro Activation
For this example we will create a hot key activated macro.
1.From the Macro Express - Explorer click on the New Macro icon to open the Create New Macro window.
2.HotKey should be the default Initial Activation and the blinking cursor should be in the HotKey edit box. If the cursor is not in the edit box, click on the edit box with the mouse to place it there.
3.Press the F4 key and then release it. F4 should appear in the edit box.
4.Enter "Zoom In" (without the quotes) in the Macro Nickname edit field.
5.Click OK to save the changes and open the Script Editor.
Set the Macro Scope
1.With the Script Editor open, click on the Scope tab.
2.Set the Current Scope to Global.
Writing the Macro
Setting the Control Variable
1.Click on the Script tab.
2.Expand the Window Controls category of commands.
3.Double click on the Get Control command to open the Get Control window.
4.Select the Hide Macro Express option.
5.Click on the Variables button to the right of the Store the Control In field.
6.Expand the Control Variables list and click on the C variable.
7.In the Variable Name field enter the number 2 between the brackets to show C[2] and click OK to save.
8.Click on the Launch Utility button to open the Capture Window Control window.
9.If the WordPad program is not visible on the screen open the program window.
10.Click on the blue X crosshairs on the Capture Window Control window and drag it over top of the "+" button in the bottom right hand corner of the window.
11.Release the mouse button to insert the control information into the Control Details panel.
12.Click the save button to save the information and return to the Get Control Window which should now look like the following image.
13.Click OK to save and return to the Script Editor.
Activating WordPad
1.Expand the Windows/Programs category and double click on Window Activate.
2.Enter WordPad in the Window Title field, leave the Partial Match setting and click OK to save.
3.Expand the Timing category and double click on Wait for Window Title.
4.Enter WordPad in the Window Title field and click OK to save. This will instruct the macro to wait until WordPad is active before continuing.
Move the mouse to the control and click
1.Expand the Mouse category and double click on Mouse Move.
2.From the drop down list select Relative to Control.
3.Enter the number 2 in the X and Y coordinate fields.
4.Click on the Variables button to the right of the Control field.
5.Expand the Control Variables list and click on the C variable.
6.In the Variable Name field enter the number 2 between the brackets to show C[2] and click OK to save.
7.In the Mouse category double click on the Mouse Left Click command twice to enter two left clicks into the script.
Macro Script
When finished the macro script should look like the following example. If something is not in the correct order, highlight the command and click on the Up or Down arrows to the right of the Script and move the command to its proper location.
Get Control: (WORDPAD.EXE) Using z-order -> %C[2]% Window Activate: WordPad Wait for Window Title: WordPad Mouse Move: 2, 2 Relative to Control: %C[2]% Mouse Left Click Mouse Left Click |
Run the Macro
Make sure that WordPad is running in the background. Notice the percent zoom range in WordPad. The default is at 100%. Press the Ctrl + Alt + 4 hotkey. WordPad gets focus and the percent zoom has changed - typically by 20%. Each click increases the zoom by 10%.