06-04-2020 08:11 AM
Hi,
I need to enter a value in a stand-alone windows program (just an industrial executable that I have no control over). Essentially I just want to automate manual key entering to avoid having to do it manually by:
1. Place the cursor over the screen xy-coordinates where the text input box is located
2. Click
3. Enter value
4. Press enter
Cheers,
Mattias
Solved! Go to Solution.
06-04-2020 08:27 AM - edited 06-04-2020 08:33 AM
Hello Mattias,
NI has an article on how automate keystrokes here: https://forums.ni.com/t5/Example-Code/Programmatically-Simulate-Key-Strokes-in-LabVIEW/ta-p/3521756
Good luck with your project!
Looking a little closer, I don't think my link above will do quite what you're looking for.
Have a look at this older post here: https://forums.ni.com/t5/Example-Code/Programmatically-Simulate-Key-Strokes-in-LabVIEW/ta-p/3521756
There is also another method of simulating keyboard events: https://forums.ni.com/t5/Example-Code/Using-LabVIEW-to-Simulate-Keyboard-Events/ta-p/3996210
06-04-2020 08:55 AM
Great, thanks Patrick,
I've had a look at the code, but unless I make a mistake, there is no way to select where on the screen I want to enter the code?
The stand-alone industrial processing control program I'm trying to control covers the whole Windows screen and has more than 30 fields/boxes where one can enter values, but I only need to change the values in one of the boxes during processing (which can run for hours, which is why I don't want to sit there and manually enter numbers all day).
Is that possible with the program you supplied and I missed it?
Cheers,
Mattias
06-04-2020 09:17 AM
Oops, it seems I accidentally posted the same link twice.
This was the second link I meant to post.
The above post mentions something called AutoIT. I have not used this personally, but there are a few examples of using it with LabVIEW.
To simulate a mouse click to select the active region in your other program, have a look at this post here: https://forums.ni.com/t5/LabVIEW/Can-LabView-generate-a-mouse-click-for-another-program/td-p/795252
There is some example code here: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000015ASTSA2&l=en-CA
It might take a some time to get all the coordinates of the places you need to click. But at least you would only have to do it once.
06-04-2020 09:37 AM
Ha ha, great, thanks, I think that'll do the trick, many thanks.
(If I don't get it to work, I may ask more questions!)
Cheers,
Mattias