09-29-2015 06:49 AM
One of my customers has an application (application B), which they do not have the source code from. The application runs on a computer within a clean room.
They asked me to write a different application (application A) on a differnt computer to interact with their current application (application B) to do some automation.
I'm using VI server (application A) to interact with application B. Works like a charm.
Now my problem. Sometimes application B opens a one button dialog (just to confirm a certain action). I can detect whether there is a popup, but I can't close the dialog box through VI server. So every time this happens, I give and alarm on application A and somebody has to go in the clean room to close the dialog box.
Is there a way that I can send a "OK" through VI server so that I can close the dialog box remotely?
09-29-2015 07:47 AM - edited 09-29-2015 07:53 AM
Ok, so here are a few options, none of which I have tried and most of which probably won't work but may be worth investigating if no-one has any other ideas:
- Can you get the VI reference of the dialogue box / window that appears? If so, you might be able to find the 'OK' button control and then use the 'Value(signalling)' property to activate the button as if it was clicked on.
- Perhaps you can simulate clicking on the dialogue box using some Windows DLL function call ? It might be possible to get a reference to the dialogue (FindWindow?)/button and then simulate a click? You might even be able to use Windows Messaging to send the WM_CLOSE message which might dismiss the dialogue? (or it might exit the application...test it!) This article mentions you might be able to send an ID_OK messsage to a dialogue.
There's also Sikuli - it's a cool tool for automating things on a GUI.
09-30-2015 11:11 AM
I don't think the VI reference method will work. The one button dialog box is a low level call to a primitive and isn't a normal subVI that is just shown.
I think the WM_CLOSE is a good idea, if you can get a handle on that window. One issue with that is again the one button dialog box doesn't have a window title, so getting this reference might be tricky. I don't think you'll be able to use FindWindow but instead get all handles and find one with no title.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord