×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Set Attachmate properties through Excel VBA

Set Attachmate properties through Excel VBA

Set Attachmate properties through Excel VBA

(OP)
Hi. Based on this thread: http://support.attachmate.com/techdocs/2654.html, I am trying to set the following properties to TRUE in Attachmate through Excel VBA.

Quote:

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.

I am using VBA in Excel, so I want to send the following commands to Attachmate:

.DisableKeystrokeProductivity=TRUE
.DisableScreenHistory=TRUE

The start of my code looks like this currently. If someone could please show me how I would set the above properties, I would appreciate it.

CODE --> VBA

Dim myscreen As Object

Function Wait()
    Do Until myscreen.OIA.XStatus <> 5
    Loop
End Function

Function System()
'Assumes an open extra session

    Set Sys = CreateObject("EXTRA.System")
    Set Sess = Sys.Sessions.Item(1)
    Sess.Activate
    Set myscreen = Sess.Screen
End Function 

Note: Users are using both Extra 6.7 and Reflection 2011 R2, so this is designed to be compatible with both.

Thanks in advance for the help.

RE: Set Attachmate properties through Excel VBA

The answer is in the article:

Quote:


For example:

ThisIbmTerminal.DisableKeystrokeProductivity = True

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Set Attachmate properties through Excel VBA

(OP)

CODE --> VBA

Dim myscreen As Object

Function Wait()
    Do Until myscreen.OIA.XStatus <> 5
    Loop
End Function

Function System()
'Assumes an open extra session

    Set Sys = CreateObject("EXTRA.System")
    Set Sess = Sys.Sessions.Item(1)
    Sess.Activate
    Set myscreen = Sess.Screen
    ThisIbmTerminal.DisableKeystrokeProductivity = True
End Function 

Adding that line results in runtime error 424 saying Object Required.

RE: Set Attachmate properties through Excel VBA

ThisIbmTerminal is an EXAMPLE! Use YOUR IBM terminal.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Set Attachmate properties through Excel VBA

(OP)
Unfortunately, this may creep beyond my level of knowledge.

From examples I have seen, I have also tried the below since myscreen has been defined in the code already:

CODE --> VBA

myscreen.DisableKeystrokeProductivity = True 

This returns the error "Object doesn't support this property or method".

Further investigation led me to this FAQ: http://www.tek-tips.com/faqs.cfm?fid=4069

Quote:

For even more functionality, add a reference (VBA - Tools>References; VB - Project>References) to Attachmate Object Library, then use this code:
<code></code>
Now you can refer to the "MyScn" object and you'll have a drop down box of all the available properties and methods.

I'm not sure if I have the correct library available, or if that is necessary. I have the below in my VBA References:
Attachmate_Reflection_Objects
Attachmate_Reflection_Objects_Framework
Attachmate_Reflection_Objects_Emulation_IbmHosts
Attachmate_Reflection_Objects_Emulation_OpenSystems

Following that approach results in an error saying all macros in my workbook are disabled. Additionally, I never get a list of properties or methods from the myscreen object.

Thanks for your quick responses.

RE: Set Attachmate properties through Excel VBA

Oh yes! you ought to have a reference set for Attachmate. I'd select all of them.

I'd also check Attachmate VB Help for the OBJECT reference for this property. I assumed from the link you posted, that it referred to the screen (terminal) object.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Set Attachmate properties through Excel VBA

(OP)
I have selected all of them. However, the ExtraScreen object in the FAQ mentioned does not seem to exist in Reflections' library. If I load the EXTRA 6.5 library, the ExtraScreen object exists, but the DisableKeystrokeProductivity property is not available for it (as expected since it will just introduced).

I noticed on these forums that the screen object for Reflections appears to be "Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen". When I am able to test on the PC with Reflections, I will try the below out and see if the library supports the property mentioned for the object.

CODE --> VBA

Public myscreen As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
....
myscreen.DisableKeystrokeProductivity 

Assuming that works, I still have some possible roadblocks:
1. Our users have both Extra and Reflections. It appears this is going to break it for Extra users. Is there a way around that which would allow compatibility for both?
2. No one is going to have the libraries loaded in Excel by default. Users of Extra will not have the Reflections object library available. Both sets of users will need to be run and edit the macro from time to time (until Extra is phased out). Having to load in an additional library introduces complexity. Is there anyway to accomplish the above property setting without dealing with non-default libraries?

I will report back if the above code works.

RE: Set Attachmate properties through Excel VBA

You can run without the libraries, as long as you do not use library constants, for one. I don't usually configure that way, but the objects can be created and referenced without the libraries.

If you have an object for Reflection then you can check for the existence of an instance by something like this

CODE

If Not oReflection Is Nothing Then
   MsgBox "An instance exists"
Else
   MsgBox "No instance exists"
End if 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Set Attachmate properties through Excel VBA

(OP)
I have not been able to get the property set as I described above. It seems all of the old way of starting off the code with Extra objects, etc. are incompatible once you start mixing in things from the Reflections library, often resulting in "mismatch" errors. So I'm guessing everything else has to change.

It looks like this is what Reflections has available to use:
Attachmate_Reflection_Objects_Framework.ApplicationObject
Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal

Could someone please help re-work my initial Extra code to work with the new format so I can set this property to the screen. I can't use the old Extra objects or else I get hit with "property doesn't exist" errors. It doesn't seem like a simple find-replace activity, and I have not had success after lengthy experimentation and attempts.

If I am going in the wrong direction, please let me know. Again, the only goal of all of this is to simply set DisableKeystrokeProductivity and DisableScreenHistory to True from Excel, in order to fix the Reflection slowness caused by these features, experienced when rapidly scraping many screens. I have users with macros that take nearly 20x longer running on Reflection compared to Extra.

Thanks.

RE: Set Attachmate properties through Excel VBA

(OP)
Note: I have achieved what I wanted in a different way. Instead of setting the property through Excel VBA, I made a small Reflection Macro that I run in Reflections before running my usual screen scrapers out of Excel.

CODE --> VBA

Sub SpeedUp()

Dim ibmCurrentTerminal As IbmTerminal
Dim ibmCurrentScreen As IbmScreen
Dim returnValue As Integer

Set ibmCurrentTerminal = ThisFrame.SelectedView.Control
Set ibmCurrentScreen = ibmCurrentTerminal.Screen
'---------------------------------------------------------------------

ibmCurrentTerminal.Productivity.ScreenHistory.ClearAllScreens
ibmCurrentTerminal.Productivity.RecentTyping.ClearAllItems

ibmCurrentTerminal.DisableKeystrokeProductivity = True
ibmCurrentTerminal.DisableScreenHistory = True

returnValue = ibmCurrentScreen.WaitForText1(900000, "xxx", 4, 9, TextComparisonOption_IgnoreCase)

End Sub 

This makes Reflection much faster for 15 minutes. I also created a button in the UI designer so I can disable the Screen History and Keystroke Productivity features before running any big macros.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close