How to Improve VBA Macro and .NET Application Performance in Reflection 2011

  • 7021454
  • 27-Feb-2013
  • 23-Oct-2020

Archived Content: This information is no longer maintained and is provided 'as is' for your convenience.

Environment

Reflection for IBM 2011
Reflection Standard Suite 2011

Situation

Long-running scripts that automate data entry or data collection through a Reflection 2011 session may run noticeably slower than similar scripts did in EXTRA! or legacy Reflection (version 14.x or earlier). Performance can be improved by turning off some Reflection 2011 features while a script is running.

Note: For efficient programming practices in Reflection Desktop 16, Reflection 2014 or Reflection 2011, see KB 7021427.

Resolution

What causes scripts to run slowly?

Reflection 2011 has some new productivity features not found in legacy Reflection (version 14.x and earlier). These productivity features include Screen History, Auto-Complete, and Spell Check, and are very useful for a typical user working directly with the Reflection terminal. However, the additional work performed by Reflection to make these features possible can have a negative impact on automated interactions with the terminal while a script, macro, or .NET application runs.

Beginning in Reflection 2011 R3 SP1, while a Reflection VBA macro is running, the productivity features and Screen History are turned off automatically to improve performance. If you want to enable these features while automation is running insert the appropriate lines in the macro:
.DisableKeystrokeProductivity=FALSE
.DisableScreenHistory=FALSE

Note: If you are using a programming tool other than Reflection VBA macros, such as Microsoft Visual Studio, VBA in Microsoft Office products, etc., set these properties to True (as described in the next section) to avoid possible performance costs introduced by these features. If you are using the legacy interfaces ReflectionCOM or EXTRACOM, you will not have direct access to these properties; you need to add new code to your project to access the new Reflection API so that you can set these properties, and then set the properties to True.

How to improve performance in Reflection 2011 R3 or earlier

For most scripts, such as recorded macros and those that complete only a short sequence of tasks, the effect that productivity features have on performance should not be noticeable. Performance of custom scripts that automate large amounts of data entry or data collection will improve if you take the following two actions:

Disable the Screen History feature while scripted activities are running

The work Reflection performs to capture and save each screen can have an impact on scripts that send a lot of keystrokes to reach many host screens. The Screen History feature in Reflection can be disabled in two ways.

For example, either Reflection VBA code sample will disable this feature:
ThisIbmTerminal.DisableScreenHistory = True
Or:
ThisIbmTerminal.Productivity.ScreenHistory.ManualCaptureOnly = True

Either command has the same effect as checking the box in Reflection Screen History settings labeled “Manual capture only.â€

Always set the property IbmTerminal.DisableKeystrokeProductivity to True

This property affects whether keys sent to the terminal programmatically are affected by features such as “Auto-Completeâ€, “Auto-Expandâ€, “Spell-Checkâ€, etc., and the default value is False.

For example:
ThisIbmTerminal.DisableKeystrokeProductivity = True

This property cannot be set elsewhere in Reflection settings; it must be set programmatically. The Reflection user interface has productivity settings that allow specific features to be enabled or disabled, however, to actually avoid the additional processing overhead from these features, DisableKeystrokeProductivity must be specifically set to True. Furthermore, the property is not persisted in Reflection settings and must always be set each time a macro runs to avoid a performance penalty. 

Additional Information

Legacy KB ID

This document was originally published as Attachmate Technical Note 2654.