LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make keyfocus on a text file?

Solved!
Go to solution

I have a simple program to simulate keystrokes in LabVIEW. 

As shown in the image, if I press the bottom right button, it generates a string "Hello" in the string field.

However, I'm only able to make the key focus on the string field I created("Output" in the image).

I want to have my key focus on places such as a text file, google search engine, or generally any other place.

Not sure how to start this. I will appreciate any suggestions.

 

I have also attached the code underneath. Thanks in advance!

jackhsu66_0-1598842538803.png

 

This LabVIEW code is based on https://forums.ni.com/t5/Example-Code/Programmatically-Simulate-Key-Strokes-in-LabVIEW/ta-p/3521756

 

0 Kudos
Message 1 of 3
(1,353 Views)
Solution
Accepted by topic author jackhsu66

The only way to key focus on things outside of LabVIEW, to my knowledge, would be to simulate mouse clicks using System Exec. This isn't dynamic at all though. You tell the mouse to go to (x, y) pixel location on screen and then click. If the search bar isn't there, nothing works. If you change your screen resolution, nothing works. If your computer is randomly crapping out for some reason and the click doesn't register, well...

 

If you don't mind me asking, what are you trying to do with this?

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 2 of 3
(1,261 Views)

Thanks for the reply!

 

I am currently trying to send key commands to control an external game in "UNITY".

I originally thought it doesn't work is because the key couldn't focus on UNITY but now I think about it this might not be the problem.

 

Now, I am thinking that I am probably only controlling Window's keyboard. And the UNITY app uses a completely different keyboard API.

So instead of sending ASCII code to Window's keyboard API, I need to find how I can send it to UNITY'S keyboard API.

 

Not sure If I'm in the correct direction, but this is where I am stuck now. Trying to find UNITY's Keyboard API.

0 Kudos
Message 3 of 3
(1,254 Views)