Solved Global Send Key Events

Pete_L

Active Member
Hi,
I am having trouble sending keystrokes using Global Send Key Events, and I'm hoping you can help. I am automating an application built in MS Access. This database contains a Main form with several buttons. Each button runs a query and presents the query results in table format. The query results table opens behind the main form, such that both the main form window and the query results window are maximized, but the main form window is in front. I am trying to send keystrokes that will select the Switch Windows button on the ribbon, and then select the 2nd item from the window list. This should bring it to the front, and it works when the keystrokes are sent manually but not with the automation.

In a navigate stage, I am sending "<{ALT}h>m2" to the root of my application model. It is not working. It presses ALT-h, but does not process the next 2 keystrokes: m2. I'm sending these keystrokes immediately after attaching to the application. I have also tried splitting up the keystrokes into 2 separate steps in the navigate stage (i.e., "<{ALT}h>" on one step and "m2" on the 2nd step. I've also tried sending "<m><2>" on the 2nd step, but it is not working in either of these designs.

Any hints or comments are welcome. Also, if you can think of a different way to bring a MS Access window to the front, please let me know.

Thank you.
 
Last edited:

sahil_raina_91

Active Member
Hi,
I am having trouble sending keystrokes using Global Send Key Events, and I'm hoping you can help. I am automating an application built in MS Access. This database contains a Main form with several buttons. Each button runs a query and presents the query results in table format. The query results table opens behind the main form, such that both the main form window and the query results window are maximized, but the main form window is in front. I am trying to send keystrokes that will select the Switch Windows button on the ribbon, and then select the 2nd item from the window list. This should bring it to the front, and it works when the keystrokes are sent manually but not with the automation.

In a navigate stage, I am sending "<{ALT}h>m2" to the root of my application model. It is not working. It presses ALT-h, but does not process the next 2 keystrokes: m2. I'm sending these keystrokes immediately after attaching to the application. I have also tried splitting up the keystrokes into 2 separate steps in the navigate stage (i.e., "<{ALT}h>" on one step and "m2" on the 2nd step. I've also tried sending "<m><2>" on the 2nd step, but it is not working in either of these designs.

Any hints or comments are welcome. Also, if you can think of a different way to bring a MS Access window to the front, please let me know.

Thank you.

Try this:
"<{ALT}h>{ALT}m2"
 

sahil_raina_91

Active Member
Thank you, sahil_raina_91. Your suggestion worked.

The issue was arising due to the fact that ALT key was not being released.
< is used to press n hold a key
> is used to release the key

<{ALT}h>{ALT}m2 : This means hold ALT and press h, then release ALT, and then press m2
<{ALT}h>m2 : This means hold ALT and press h, then release m, and then press 2 (ALT was never released, m was never held, leading to improper keystrokes being sent)
 
Top