FTRA (Foglight Transaction Recorder Advanced) is a unique solution for monitoring complex thick client or custom applications. Using image recognition, it is able to exercise virtually any application which can be run natively, emulated, or even viewed with remote terminals on a pc.
The video explains how this particular example is created and references a VB script which is below.
Note this script was built using a wizard driven mechanism requiring no need for Visual Basic experience.
Comments have been made in green text to explain the different steps.
'Foglight the Pinball Wizard...
'Script by Steve Healy of Quest Software
'Revision 6 April 2011
Option Strict On
Option Explicit On
'Sets variable to capture high score'
Dim iHighscore as Integer
'Open the Pinball app'
returnStatus = AppStart ("C:\Program Files (x86)\Windows NT\Pinball\PINBALL.EXE", "Verify Pinball open.bmp")
If returnStatus <> SUCCESS Then
'Wait till ball is in place to start game
returnStatus = WaitForImage("readytodeploy.bmp", STANDARD_TIMEOUT, "NONE")
'Launch the Ball'
SetComment ("Launch Ball")
returnStatus = KeystrokeVK ("VK_MENU", KEY_PRESS)
'This is a loop telling Foglight to keep playing until the third ball has been used up'
Dim Play as Integer = 1
Do While Play=1
'Tell Foglight to look for the ball near the flippers. This shows the tool looking for something more complex than just a simple image'
returnStatus = WaitForAreaToChange("ball near bumpers.fixed", 12)
'If Foglight sees the ball near the flippers, engage both flippers. The logic could be modified to engage them independently'
SetComment ("This enables both flippers")
returnStatus = KeystrokeVK ("VK_DELETE", KEY_DOWN)
returnStatus = KeystrokeVK ("VK_END", KEY_DOWN)
returnStatus = KeystrokeVK ("VK_DELETE", KEY_UP)
returnStatus = KeystrokeVK ("VK_END", KEY_UP)
'Foglight will watch the number of balls left until it shows empty indicating the end of the game
returnStatus = WaitForImage("Noballsleftgameover.bmp", 1, "NONE")
If returnStatus = SUCCESS Then
SetComment ("Game Over")
Play = 0
'Foglight waits to see it's score'
returnStatus = WaitForImage("Scorearea.bmp", STANDARD_TIMEOUT, "NONE")
'Foglight now reads the high score to a log for future use.
returnStatus = ReadTextLine("HighScoreRelative.relative", "MSSansSerif8", STANDARD_TIMEOUT, 0+ INCLUDE_NUMERICS)
returnStatus = LogMessage (TextRead, "c:\High_score.txt")
'Foglight now inserts a comment so all are aware of this achievement'
KeystrokeString ("The Foglight Cannot Be Stopped")
'Foglight then modestly clears the high score to assure success on the next round'
returnStatus = ClickOnImage("Clearhighscore.bmp", LEFT_BUTTON, 1, STANDARD_TIMEOUT, "NONE")
returnStatus = ClickOnImage("clearhighscoreconfirm.bmp", LEFT_BUTTON, 1, STANDARD_TIMEOUT, "NONE")
returnStatus = ClickOnImage("Cancelafterhighscore.bmp", LEFT_BUTTON, 1, STANDARD_TIMEOUT, "NONE")
'Foglight says goodby to the game until the next scheduled round which is controled from the Foglight console'
SetComment ("...Aint seen nothing like him in any amusement hall...")