VCXO Posted January 31, 2021 Report Share Posted January 31, 2021 I just need an example vi or tool can do following automatically instead of mouse click and enter keyboard: 1. Detect the application window (handle), click one of the buttons(most of time just a OK button) on it. 2. Fill out one blank try on the window. (I already have vi can read strings from file). In the test, I have to repeat above 2 steps hundreds of times, with click different button, enter string manually. Now I do it manually which is boring and time consuming. I want to automate the test and have some vi to read string from file, decide which button to click, etc. Just need Labview code which can perform button click and string enter on the dialog. Thank you for any suggestions ! Quote Link to comment
hooovahh Posted February 1, 2021 Report Share Posted February 1, 2021 There are several libraries online for simulating keyboard presses and mouse interactions. https://forums.ni.com/t5/Example-Code/Programmatically-Simulate-Key-Strokes-in-LabVIEW/ta-p/3521756?profile.language=en https://forums.ni.com/t5/Example-Code/Using-LabVIEW-to-Simulate-Keyboard-Events/ta-p/3996210?profile.language=en https://forums.ni.com/t5/Example-Code/Simulate-Mouse-Click-on-a-LabVIEW-control/ta-p/3509840?profile.language=en Quote Link to comment
VCXO Posted February 1, 2021 Author Report Share Posted February 1, 2021 Thank you for example of key enter and mouse click ! One more question, in Labview, how to get the handle/ref of the running windows/dialog ? And the handle of the button/string box on that window ? Basically, the application (exe) is running will pop up a dialig with 1~3 buttons and one input box. Now I have to enter the string and click button through key board manually. I need code a separate Labview tool to click button, enter string on that dialog. Many thanks for your time and help ! Quote Link to comment
hooovahh Posted February 2, 2021 Report Share Posted February 2, 2021 Here is a VI that gets the title of the window that is active. You could then continually loop until the title you expect is active, then perform operations. https://forums.ni.com/t5/LabVIEW/Get-Current-Active-Window/m-p/3930389#M1116926 Quote Link to comment
Rolf Kalbermatter Posted February 6, 2021 Report Share Posted February 6, 2021 (edited) On 2/1/2021 at 6:20 PM, VCXO said: I need code a separate Labview tool to click button, enter string on that dialog. Is that other application a normal Windows app or a LabVIEW executable? In most normal Windows apps each control (button, numeric etc) is really another window that is a child window of the main window. LabVIEW applications manage their controls entirely themselves and don't use a window for each of them. They only use a window for the main window of each front panel and for ActiveX/.Net controls. Edited February 6, 2021 by Rolf Kalbermatter Quote Link to comment
VCXO Posted February 6, 2021 Author Report Share Posted February 6, 2021 LabVIEW executable (or LabVIEW source code when debugging). I need simulate clicking the "start" button and "X" of the window to close the executable. During some steps of the sequence, this mother window will pop out a children window or dialog. I need simulate enter a barcode (string), clicking the "OK" button. Then sequence will run ned step. Please provide some example LabView code can perform above functions. Thank you so much ! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.