..:: Blog ::..

 ToolBook Blog Minimize

Jan 22

Written by: Tomas Lund
Tuesday, January 22, 2008 10:26 AM

Or - How to tweak ToolBook Simulation AutoBuilder

Ever had a recorded simulation where certain objects of the recorded application did not update between steps, even though it did during the recording?

This article describes how you (in most cases) can get around that problem. It also gives an overhead view of what goes on behind the scenes when a Simulation is recorded and built using the Simulation AutoBuilder feature of ToolBook.

Show me!

The best way of describing what I mean is to show you want I mean.

Click this link to see two ToolBook simulations that describes how preview different image compression settings in Adobe ImageReady.

There are two pages in the Book; on the first page I am using the Simulation AutoBuilder as is. The result is not very useful - for reasons that I will explain below.

On the second page I have made a very simple modification to the system before inserting the same recorded simulation, and the result is much better.
A note, I have spent 5-10 minutes modifying each Simulation after they were built, doing minor thing like changing the way the hotspots are referred to by the automatic Instructions etc.

Backgrounder

Before we get on with the tweaking, let's take a quick look at what happens when a simulation gets recorded and built, so we have a better understanding of the process.

A note on "controls" and windows in Windows

To get a better on understanding of the following section it is important to know that in Windows, most controls (buttons, fields, combo boxes etc.) are really windows of different classes.

So what visually looks like as a windows button in an application is (typically) a child window of the window displaying the button.

To see what I mean, open a spy program like winspector or spy++, and check out what controls are really windows, and see what kind of information you can get about the objects (Windows). Most Spy programs have a feature that allows you to find the window you want by dragging a cursor on top of the window and releasing it.

WordPad is a good program to test regular windows classes with, so try opening WordPad and then open your spy program and check out what objects are really windows.

What happens when a simulation is recorded?

When a step is recorded in the Simulation AutoBuilder Recorder (i.e. when you hit Print Screen), information about the different objects within the application being captured is "grabbed" from Windows. A screen dump of the screen and various other bitmaps are also stored. The information is stored in a compressed form in the .tbr file.

What happens when a simulation is built?

When a simulation is being built based on captured information (via the "insert/Simulation from recording") the captured information is analysed and the objects are built.

"Controls" (i.e. windows classes) that are known by the Simulation AutoBuilder are built as ToolBook objects, and the state and properties of each Windows control is mapped to ToolBook properties (if applicable).

The Simulation AutoBuilder deals with changes in properties between steps either by creating simulation actions or by settings up properties on the ToolBook Simulation object.

Windows of classes that are not known by the Simulation AutoBuilder are created as bitmaps based on how they looked at the first step they appeared in the capture.

Special cases and controls that are not windows

If you tried the spy program before on WordPad, you may have noticed that some objects (Like the buttons in the Toolbars) are not Windows. So just getting information about all Windows in the application we are capturing - won't get us any data about the state and style of each Toolbar button, and therefore the Simulation AutoBuilder cannot reflect any changes in the simulation if it solely relied on information about windows.

You could say that the Toolbar is a black box that we cannot see inside.

Off course, since Toolbars are so widely used, every time a Toolbar window is encountered special measures are taken to ensure that we do get the data we need to build the Toolbar buttons properly.

The problem

There are probably as many Windows classes as there are Windows programmers, so it is not realistic to do special calls to each different class in existence.  - And in some cases there is no (documented) way to see "inside" a Window.

Enter Blackbox classes

Since we cannot get and set properties from classes like these, we can at least make sure that the bitmap is updated for each step, so it visually looks like the application we are capturing.

Blackbox classes are classes that the Simulation capture tool cannot "see inside", that we want to represent as a new bitmap for each step, in order to maintain visual resemblance to the application that is captured.

An example of a blackbox class is the Macromedia Flash Player. While it is possible (and documented) how to get information from a flash player it is currently not included in the simulation Auto Builder Recorder. (And the question is whether that would be a desirable feature)

However since it is very likely that the visual appearance of a Flash player will change during the course of a capture, the class name of the flash player's display window (MacromediaFlashPlayerActiveX) is added to a called SimBlackClasses.ini in the ToolBook product directory.

This tells the Simulation AutoBuilder to create a bitmap of the Flash Player for each step in the simulation instead of just creating a bitmap for the first step in occurs.

(If you open the SimBlackClasses.ini file you will notice that the class names in file are not stored in an ini file format, but rather in a text line format with one class name per line)

Now back the initial example

First you must get the class name of the window we want represented by a bitmap for each step it is visible.

To do build the simulation in ToolBook, then open the property browser and look for a userproperty called Classname (You could also use a spy program and look at the actual application). No matter how you find the classname you will notice that the class of the window is PowerSportChildWindow.

Now take a backup copy of the SimBlackClasses.ini file and add "PowerSportChildWindow" (without the quotes) to the original SimBlackClasses.ini file after the last line of the file (currently "#32768"). Save the SimBlackClasses.ini file and re-import the simulation.

That's it!

Try it out for yourself

If you want to try it you can download the .tbr file I used to build the demonstration simulations you saw in the beginning of this article.

Note that this tweak may not work in all cases, and you may have to experiment to figure out what class names work as BlackBox Classes and what do not.

A word of warning: If you do anything wrong you can screw up the way simulations are built. I strongly recommend that you take a backup of any file you alter so you can undo any tweaks. If you don't take a backup and something goes wrong you will probably have to reinstall of ToolBook in order for ToolBook to work properly again.

That said it is really not that difficult - as long as you are careful what you do.

I hope you have found this article useful, comments and suggestions are welcome at tlund@elearningspecialist.com.

As always - Happy ToolBooking

Tomas Lund
 

Tags:

4 comments so far...

Re: Blackbox classes

Tomas, two things:

a) the link you provided "download the .tbr file" doesn't work
b) do you know why when i insert a simulation recorded, the toolbook doesn't generates any object, left the page blank, just change the name.

Hernan

By Hernan Depassier on   Thursday, January 17, 2008 6:59 PM

Re: Blackbox classes

Hi Hernan

Thanks for bringing the bad link to my attention, it is fixed now.
As far as you other question goes... I am not sure what causes this. As a first step in trying to find the problem you could try and build the tbr file from this article. If that works then there is not a problem with your setup, but with the tbr file you are trying to build.
Let me know how it goes

Tomas

By TomasLund on   Tuesday, January 22, 2008 10:34 AM

Re: Blackbox classes

I couldn't insert your tbr (imageready.tbr), the command insert recorded simulation in toolbook, appears to be working say analyzing items, building etc and simulation insertion is complete, but none object or group is inserted in the blank page.
Once using another tbr, I was able to insert a recorded simulation, but I wasn´t able to repeat it in another book.
And it was just an excel ( I added XLMAIN and EXCEL7 classes after line #32... but nothing, may there is a setting or something strange with the toolbook i am working 2004 sp2.
thanks anyways

By Hernan Depassier on   Friday, April 25, 2008 6:00 PM

Re: Blackbox classes

Hi Hernan

I dont know why you cant build tbr files. Sounds like a systemwide problem to me. I notice you are using 2004 sp2, you should upgrade to 2004 sp3. Despite the service pack name indicating just small improvements, SP3 was a big improvement over sp2. You can download the upgrade for free from ToolBook.com. I hope this helps

By TomasLund on   Monday, April 28, 2008 8:35 AM

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  

  
 Search Minimize


  
 Quick links Minimize


  
 Blog List Minimize


 Print   


Copyright 2007 by ToolBookConsulting.com   Terms Of Use  Privacy Statement