We have got a robot waiting until the user opens an application (iAccess Client by IBM emulator) with the adapter as "MonitorAll" start method. The event that fires the execution of the main automation of the robot is a "Created" event of a control. This robot works correctly but we want to know how to monitor more than one instance of the same application; opening second instance of the application the Created event is not captured by robot.
***Edited by Moderator: Pooja Gadige to add platform capability tag***
@HectorSMG If you need to attach to multiple copies of any control, you would enable the UseKeys property of a given control. This would then allow you to access each instance of the control via a unique key.
I know that UseKeys property is used to access each control but I think this has got a restriction, which is that those controls (one key for each control instance) have to be in same adapter.
The application I am monitoring is an emulator, so I use a windows adapter. In my case, what I need is to keep robot monitoring (adapter with MonitorAll as StartMethod) more than one instance of application. I haven't got more than one control in same application I want to monitor more than one application instance.
In other words, when runtime is running when I open the application the robot catch the event and execute the automation but if open a second application (without closing first application) the robot doesn't catch any event. The robot only detects the first application instance I open.
@HectorSMG If you are using MonitorAll, you will "hook" into each instance of that application. You would enable UseKeys for the top level control in your object hierarchy. For example; if you were to interrogate notepad, you would enable use keys on the one named "frmUntitled_Subtraction_Notepad" (assuming you leave the control with its default name). When you run notepad again, you'll now see two of these in the targets window.
You can add a screenshot of your adapter and I can help you identify where, but it really should be the highest level control in the adapter where UseKeys would be enabled.
Since you are using an emulator though, we do provide a component that might help. It is called the WinHLLAPIUtils. This component can fire an event when a new emulator session is created. As part of that event, it will pass the short session ID as an argument, so you can use that to determine if you want to start your text adapter (or set the short session ID of your text adapter and then start it). I generally use this in cases where I don't need to do any automation of the emulator itself as this just makes it easier to know when to start your text adapter.
I have managed using UseKeys to catch starting event of more than one application instances; I have attached a file to show you how I am starting the automation. Each application instance fires frmSession Created event. Now my problem is that winHLLAPIUtils component just read first session. In other words, when I open first application instance I read session A from winHLLAPIUtils and it works fine. When I open second application instance winHLLAPIUtils doesn't read new session. I tried using winHLLAPIUtils SessionCreated event but I don't know how to wait both events: frmSession Created and winHLLAPIUtils SessionCreated.
@MiguelServandoS You wouldn't wait for the SessionCreated event from the WinHLLAPIUtils. You'd simply use that event to start your text adapter with the same SessionID (if it isn't already running). Here's an example.If you wanted to wait for that event though, you can right click on it and select "Wait for this event" and that will convert it into a method you can use to wait for it.