Pulover's Macro Creator Tutorial: Control Commands

Pulover's Macro Creator
Pulover's Macro Creator
43.4 هزار بار بازدید - 11 سال پیش - Watch the tutorials for PMC
Watch the tutorials for PMC version 5: Pulover's Macro Creator v5 Tutorial 1

Transcription:
Control commands are one of the most useful features.
You can use them to directly control a window by clicking buttons, setting text and other things.
It's usually more reliable and should work with windows in the background too.
You can use it to modify a control, enable or disable it, move it, hide it, etc.
And also retrieve information like the items from a ListView for example.

For this demonstration I'm going to use 7-zip File Manager.
We're going to access the options window and make some changes.
Let's add a Run command and WinWait to make sure the window is open.
You don't need WinWaitActive in this case because we'll not send normal clicks or keystrokes.
There doesn't seem to be a shortcut to access the options so let's use another command.
Copy the window class from the WinWait command and open the Run command window.
From the Run window command list select WinMenuSelectItem.
In WinTitle paste the window class.
In Menu type the name of the main menu you want to access, which is Tools in this case.
The SubMenu is Options (you can omit the 3 dots).
Uncheck the previous commands and run a test.
Notice that WinMenuSelectItem will not work with non-standard menus such as the ones from Internet Explorer.
Add another WinWait for the options window.
In the first tab will use ControlClick to click on the "Select All" button.
Select the Mouse command and check the Control option.
If coordinates are blank it will click at the center of the control.
Click on the Get button and place the cursor over the control.
Right-click to get the control name.
Notice that this will automatically retrieve the window's class to save you some time and clicks.
Now go to the Control commands.
We'll use the control command and the TabRight subcommand.
Click on the Get button and place the cursor over the tabs control.
Press the right button. Now click OK.
Uncheck rows 1 to 4 and run the macro to test it.
On this tab we're going to uncheck the last two options.
This is a ListView control so we cannot use the Uncheck command.
Let's use a ControlClick instead.
This time we'll set the coordinates to checkbox we want to click.
Duplicate the command and get the coordinates for the last checkbox.
Duplicate the TabRight command.
In this tab we'll use the Check command to select the third option.
Insert another control command. Select ControlSetText from the list.
Get the name for the folder field.
In the Value field type the path for the folder.
Duplicate the TabRight command again.
This time we want to skip the next tab so edit the command and add a 2 to the Value field.
Let's use the Check command again to mark the first and fifth option in this tab.
To finish, add a ControlClick to the OK button.
I'll close the window without saving the changes and close the program.
Check all rows again and run the macro.
Going to options you can see that all commands have worked.
Those are the principles to automate common windows programs.
Notice that Control will not work on browsers and programs that use non-standard controls.
11 سال پیش در تاریخ 1392/07/02 منتشر شده است.
43,478 بـار بازدید شده
... بیشتر