04-30-2019 01:29 PM
I am trying to send keyboard commands to a third party application. I have successfully launched the app, but can't send alt+u+enter command to the app.
Can someone please tell me how can I accomplish this?
Thanks.
05-01-2019 10:49 AM - edited 05-01-2019 10:50 AM
Assuming the programmatic keyboard button presses are set correctly, it looks like the button presses are occurring before the third party application is launched and able to capture the keyboard input.
It looks like you are trying to place a delay of 1000 ms following the System Exec and prior to the key presses, but since the wait has no prior data dependency input, it begins to count down as soon as the VI runs. Also, the System Exec is set to NOT wait until completion, so moves past this function almost instantaneously. I would recommend trying to set the wait until completion to TRUE and starting the wait 1000ms after the System Exec call. If that doesn't work try increasing the wait time. If that doesn't work, the third party application may need window focus to pick up and respond to the key presses, which is also possible to do programmatically through LabVIEW.
05-01-2019 04:43 PM
Are you sure your third party app is getting into the foreground when launched? The keyboard messages only get send to the foreground app. Launching an app by another process does normally not make that application the foreground process. So you may need to use quite a bit more of Windows API calls to wait for the new process to be fully active, determine its main window and sending that window into the forrground before attempting to simulate key presses.