cancel
Showing results for 
Search instead for 
Did you mean: 

Global Send Keys Event requries mainframe to be in focus

jasre
Level 3
I am working on an object which is using interfacing with an IBM Mainframe. To confirm inputs is used either Ctrl ("{CTRL}") or NumPad Enter ("{Enter}"). While both of these works just fine while the mainframe window is in focus, they do not work if any other window is the one in focus. E.g. if you press "Run" in the Object Editor, the editor will become gain focus, and Global Send Keys Event no longer works. This can be countered by manually clicking the mainframe window to regain focus, but this seems somewhat silly. Is there anyone who knows a way to get Global Send Keys Event to work on an IBM Mainframe, regardless of whether or not it is the focused window?
11 REPLIES 11

jasre
Level 3
I might (unfortunately) have found the answer to my own question... *The importance of focus* It is necessary for the application to have the focus in order for Global Send Key Events to work, otherwise nothing is sent. To retain the focus when the keys are being sent it may be necessary to launch the window and then immediately send the keys as the next step. Source: https://blueprism.knowledgeowl.com/help/how-do-i-use-global-send-key-ev

You shouldn't need to use global send key events with mainframe. Blue Prism offers native support to several types of mainframe emulator e.g. IBM Personal Communications, Attachmate etc which allow you to read and write to the screen using the emulators own automation objects or API. This provides the fastest method that doesn't require the emulator to be activated. Which mainframe emulator are you using?

jasre
Level 3
As far as I can tell, I am using IBM Personal Communications. I have tried choosing both ""Mainframe (IBM)"" and ""Mainframe (IBM PCom HLLAPI)"" in the Application Modeller Wizard. Both works to some extend, but the one called ""Mainframe (IBM)"" seems to work best. No matter which I pick though, the window still needs to be in focus, if I am to send the ""Enter"" equivalent command, which is ""Ctrl"".

AkosPasztor
Level 3
Jasre did you find the solution for this? I have the same problem. I have to switch the focus between an IBM mainframe and a lotus notes application, but I don't know how can I birng the mainframe application foreground again. (i don't wanna restart it every time i have to use it)

Denis__Dennehy
Level 15
You should be using the Mainframe emulator, there is a guide on mainframe automation in the portal, there are lots of knowledgebase articles about mainframe automation, and if you are still having problems using the mainframe interface reach out to someone in Blue Prism for support/help. If you do need to interface with a mainframe using the windows interface (i.e. if it is over Citrix) - there is also a guide on the portal about surface automation of mainframe emulators. Focusing/activating windows is basic Surface Automation - the surface automation tells you all about how to active appliactions.

DavidWhite
Level 2
Jasre, have you tried using Global Send Keys (not Global Send Key Event)?.

AkosPasztor
Level 3
@David global send keys doesn't work for me, it just types in the code instead of sending the key. @Thanks Denis, but I already read those, the problem is, there isn't Activate Application action in the navigate stage with my Mainframe application. So i guess i will ask the Blue Prism Support. In the worst case i will write an external script, because i couldn't import the user32.dll either without an error to use it in a code stage.

What send key are you testing for Global Send Key? And are you using curly braces or square brackets e.g. ""{ENTER}"" or ""[ENTER]""?

Denis__Dennehy
Level 15
I suggest you seek out a mentor (either within your organisation or within Blue Prism) who can help you as this thread looks very confused to me. 1. Always use the Mainframe interface type (the one with the Grid overlayed over the mainframe screen) - not the Windows interface for mainframes UNLESS you have a very good reason not to (such as it being presented over Citrix). 2. For the Mainframe interface (which uses hllapi API), there is a Mainframe Automation Guide, and lots of articles in the knowledgebase. If your mainframe is not hllapi complient I suggest finding a hllapi complient mainframe instead of going down the Surface Automation route (it will be cheaper in the end - as SA=slow and more BP licenses, hllapi=very quick). 3. For your last comment Akos, you can activate any window in an operating system, irrelivant of the application type. You would need a Windows object for the mainframe, you would need to identify the entire window (not an element within it) using Win32 mode, and the Activate Application action in a mainframe stage will be available to you. However, if you are using a Mainframe interface the window does not need to be active. There is a guide all about Surface Automation of Mainframe Emulators that can be usd.