Tuesday, January 18, 2011

How to automate window operation with window & control commands?

Software Environment
Version: 4.3.4
Edition: Standard, Professional, Excel

Brief explanation: Example of using window & control commands (The window & control commands wizard is on "Window & Control" button of "General actions" group panel) to operate the calculator (Windows XP default).

Detailed steps:
1. Open the calculator.
Code: <Open("calc")>

2. Wait for the calculator window appears, ready to use control commands.
Code: <WaitWin("calculator")>

3. Click the number 7.
Code: <ClickCon("calculator","button5")>

4. Click the multiplication symbol.
Code: <ClickCon("calculator","button18")>

5. Click the number 9.
Code: <ClickCon("calculator","button13")>

6. Click the equation.
Code: <ClickCon("calculator","button21")>

All code:
<Open("calc")> ;Open the calculator.

<WaitWin("Calculator")> ;Wait for the calculator window appears.

<ClickCon("Calculator","Button5")> ;Click the number 7.
<ClickCon("Calculator","Button18")> ;Click the multiplication symbol.
<ClickCon("Calculator","Button13")> ;Click the number 9.
<ClickCon("Calculator","Button21")> ;Click the equation.