Deal with a Simulated Object

Top  Previous  Next

Example: The toolbox of Microsoft's Paint utility (c:\windows\system32\mspaint.exe) is a compound object that contains custom buttons and is surrounded by a containing box.  To understand this completely, start mspaint.exe from the SmarteStudio.

Steps:

(1) Open a new test under SmarteStudio.

(2) Press the Record/Learn button on the application bar.

(3) When the "Select an Application to Record" dialog appears, select the Run Application tab.  Enter mspaint in the "Full path to application" edit box.  Press the Run button.

If you are unfamiliar with MS Paint, take a few minutes to play with it.

In particular, notice the toolbox that appears in the upper-left margin of the utility and the colour selection box that appears on the bottom-left of the application window.

(4) Press Ctrl+5 to spy on the UI.  Press Ctrl+G to spy on the Paint application.  Notice several things about the behaviour of the MS Paint applciation under SesSpy.

(i) As you move the mouse inside the tools box, the entire surrounding box will show a red highlight but the individual tool buttons will not.

(ii) The same is true of the colour palette and the bottom-left of the screen.

(iii) As you move the mouse over the apparent buttons and controls, the information in the spy dialog is more sparse than for other applications.  The tool buttons do not have default actions, and they are not identified as buttons.  Rather they are identified only as "child" objects.

This combination makes it impossible for SmarteStudio to identify and learn the objects as integral objects.

Furthermore, notice that as you change the size of the Paint window, the relative positions of the colour palette and the tool box change.

 

The only way in which SmarteStudio can be 'taught' these controls (and others we will discover later) is by "simulating" them as though they were buttons that can accept commands such as the press event.

 

In fact, SmarteStudio will recognize these non-objects without you having to take particular action.  Let's discover this and what it means:

(1) Open a new test under SmarteStudio; call it MSPaint.

(2) Press the Record/Learn button on the application bar.

(3) When the "Select an Application to Record" dialog appears, clear all selection boxes in the library list box.  You will have to scroll that section of the dialog box to make sure all selections are clear.  We are choosing no loaded libraries so that SmarteStudio will not be able to "cheat" and know about any objects on the screen.

(4) select the Run Application tab.  Enter mspaint in the "Full path to application" edit box.  Press the Run button.

(Applications that reside in C:\windows\system32 can be started by their names because C:\windows\system32 must be in the system path.)

(5) When the Recording Activity dialog is displayed, press Learn (Ctrl+2)

(6) Do a small amount of things in Paint.  For example:

(i) Click on the light-grey colour in the palette.

(ii) Click on the tipping paint-can (Fill with colour).

(iii) Click on the empty canvas.

(iv) Click on the red colour in the palette.

(v) Click on the "A" tool (Text).

(vi) Click in the canvas and type a few characters, such as "Hello."

(vii) Click in a blank place under the tool button.

(7) Look at the Recording Activity dialog grid.  It will be something like this:

SimulatedPaint

Notice that the two clicks in the canvas were recorded as "simulated" objects.

Notice also that the two pairs of clicks in the tools and colours sections were recorded as LClick (left click) in "Tools" and "Colors".  However, there are no objects by these names.  To find out where these pseudo objects came from, we need to look in the file MSPaint.objects.js (the name will be the name you gave the test project).  The following excerpt from the MSPaint.object.js shows the start of the definition of the "Colors" object:

Simulatedobjectjs

 

(8) Press Ctrl+3 to end the recording.