1. Starting Guide

<< Click to Display Table of Contents >>

Navigation:  1. Starting Guides > 1.9.1 Types of controls >

1. Starting Guide

1.9.1 Types of controls

Previous Top Next


Starting Guide

 

Working with controls

What can we do with controls?

 

clip0544

 


 

How do we classify controls?

 

We classify them by their "control class". You can see the class of a control in the "windows inspector" that is built into the editor. For this, just move the mouse over the control and take a look into the Inspector. In our example the class name is "button".

 

Move the mouse over this control.

 

graphic

 

Then you will see this in the inspector, and know "its a button control". BUt i believe you have had that idea "this is a button" before.

 

graphic

 

 


 

What do we have to do with controls?

 

We need to work with controls in several ways. Some controls like buttons are simply clicked with the mouse.

 

Other controls like the text-box below, need to be read. Or we may need to type text into them.

 

graphic

 

Here is an example, that reads a text out of a control. The control is a "SysIPAddress-Control" in our TestApp, which you can find in the Sample Application folder.

 

STW.ct|PBWindowClass:0|TestApp

SCW.nc|1|SysIPAddress32

CFW.$$TXT|u

 


 

What can we do with controls?

 

An Automation System like this one needs to work with controls in several ways. Note that all things described here can be done with mostly any control, not only with the button control, that we take as example here. Now, what can we do with it?

 

1.   Controls can be enabled or disabled (use SWS.).

2.   Controls can be made visible or invisible (use SWS.).

3.   Controls can be closed (means they are destroyed, there is no way to get them back unless you restart the application)

4.   Controls can be re-sized (change the size of a control)

5.   Controls can be repositioned (move them around)

6.   The Controls Text can be changed.

7.   Then there are specific properties of controls that can be influenced. For example, a List box can change the actual selected item. Or a scroll bar can be moved up or down.

 

You can try these with our TestApp anytime without danger. All changes you do to the Application will be lost when you close the Application. Nothing of these is permanent in any way. Here are some examples:

 

STW.ct|PBWindowClass:0|TestApp

SCW.nct|1|Button|Button 1

' This will disable the button

SWS.d

 

will disable the button 1, making him look like this:

 

graphic

 

Now its important to know that the system will not detect disabled buttons in its standard settings. To reverse this last operation, we have to change something:

 

STW.ct|PBWindowClass:0|TestApp

' We have added the "a" prototype

SCW.ncta|1|Button|Button 1

' This will enable the button again

SWS.e

 

graphic

 

Will bring the button back to life. SWS. gives you the power to make all sorts of control invisible. Or disabled. Or get them back. Here are some of the SWS.-Options. Note that you can use multiple of them in one line.

 

STW.ct|PBWindowClass:0|TestApp

' We have added the "a" prototype

SCW.ncta|1|Button|Button 1

' This will enable the button and make it invisible

SWS.ei

 

 

' These are some prototypes from the SWS.-command.

'

' a - activates the window after setting the state.

' e - enabled

' d - disabled

' v - visible

' i - invisble

' m - minimzed

' n - normal (not minimized)

' z - zoomed (maximized)

 

 


 

Can I maximize and minimize a  control?

 

It does not make much sense, but Yes - you can!

 

STW.ct|PBWindowClass:0|TestApp

SCW.ncta|1|Button|Button 1

' This will minimize the button

SWS.m

 

For example, a minimized Button  looks like this:

 

graphic

 

If you double click it with the mouse he will get normal again. Be careful with maximizing of controls, as there is no easy way back. You may have to completely "close" the control like this:

 

STW.ct|PBWindowClass:0|TestApp

SCW.ncta|1|Button|Button 1

' This will completely remove the button

CLW.

 

to get rid of it.

 


 

And how about the text in controls, can we read it, and change it?

 

We are not really going to be complete with our list here. We will just look at the most important things, that  we can do with controls. And one of these is, that you can read text from  controls.

And you can change this text.  Not from all controls, but you can try!

Let's try this with a button.

 

This time we'll not use our TestApp, but a real setup-program. This one:

 

 

graphic

 

 

First we are going to read the text on that button:

 

STW.ct|#32770|Mozilla Firefox-Installation

SCW.nct|1|Button|Weit

CFW.$$TXT|u

MBX.$$TXT

 

graphic

 

Which works as expected, see above picture.

 

Next we are going to change the text in these buttons.

 

graphic

 

Now one final thing. Let us disable the "Cancel" button, so that nobody can press it.

 

This is our script:

 

STW.ct|#32770|Mozilla Firefox-Installation

' We use a pattern so that it will work in german and english Setups

SCW.nct|1|Button|Abbrechen&OR:Cancel

SWS.d

ENR.

 

graphic

 

Which of course also worked as expected.

 

 


 

clip0546

 

Are There Controls That Don't Support All These Features?

 

Indeed, there are. Certain dialog boxes contain controls that require a different approach because they aren't traditional windows controls. These include:

 

1. Dialogs in Office programs

2. Browser dialogs

3. Dialogs generated by Java

 

When working with these types of controls, the window inspector may not display the expected "button" class. For instance, consider this dialog from Word.

 

graphic

 

 

clip0547

 

Navigating Web-Based Controls

 

The SPR toolkit is adept at handling web-based controls. For instance, to pinpoint a button, you would employ the SAO, AGR, or NAV commands.

 

The effectiveness of automation scripts can vary depending on the browser used for dialogues. While Internet Explorer is no longer available, Firefox is recommended and highly compatible with our automation tools. Other browsers might pose challenges when trying to locate elements using our primary tools.

 

Nevertheless, we have a robust solution: a system of graphical recognition commands. These commands can be utilized in less compatible browsers and even in Java-based applications, which form a third category of applications.

 

It's crucial to understand that Java-based applications often resist scripting using traditional windows-control-commands. Even browser-control-commands, which typically work well in office applications, might not be effective here.

 

However, there's no cause for concern. Our fallback strategy always involves the use of graphical recognition commands. These commands are highly adaptable and can be employed in nearly any environment.