LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

external GUI Manipulation

Solved!
Go to solution

Hi,

 

Looks like you are on a better path, but if you do end up resorting to simulated key strokes you may find the attached VI useful for trying out combinations.

 

Cheers,

 

Blue 

0 Kudos
Message 11 of 26
(2,734 Views)

Msharma,

after going down a similiar path trying to use windows API, i found a much simplier way to perform automation. U can use your "System Exec.vi" located in the communication pallette to run Autohotkey scripts or the like. Download Autohotkey from there website.

 

In a nutshell,  I installed Autohotkey. Record a script (aka macro) using mouse and keyboard clicks. Autohotkey has 2 exe, one is for recording the other is for running. Once you save your script file, you need to set the OS default file type to the AutoHotKey run (not record) assuming you have admin rights for all user accounts.

 

When its time to run the automation part, I send a system exec command to run the Autohotkey script. from that point on its automated... .

 

regards,

0 Kudos
Message 12 of 26
(2,716 Views)

Thanks for the help everyone.  .NET was proving to be a little difficult, so chose to use the Auto it interface on labview to automate the WTM software.  it works well, but I do have a small annoying problem. 

 

My main interface VI is made up of several subVI's that I pass the Autoit ActiveX reference to. I first open the automation reference, then pass it to the subVIs within which  I'm invoking several methods to perform certain tasks.  It works well for the most part, except when I start labview.  It is a weird error that anytime I close labview and start again, the initial run never works unless I delete the input to my sub VI and re-add it.  After this, the VI runs normally, but the problem is encountered again when I close labview all together, and re-start. 

 

Any idea what's happening?  Clearly after highlighting my execution, I saw that after opening the autotit automation, the reference from the open automation to the input of my first sub VI is not correct or causing some error.  I've attached a visual for this:

 

 






0 Kudos
Message 13 of 26
(2,660 Views)
You have to attach your images to a post so they're uploaded to the NI servers. You cannot link them to files on your computer since we cannot see your computer (normally).
0 Kudos
Message 14 of 26
(2,649 Views)
my bad.  still kinda new to this html business.  here they are.
Download All
0 Kudos
Message 15 of 26
(2,647 Views)

Sorry. This thread completely fell off my radar. I don't know if you're still having problems, but can you provide any more information about the error? What does it say in the "source" part? Can you upload your code?

 

Side-note: in your while loop you're using a local variable to read the value of the Listbox. Just use the control terminal - it's right there.

0 Kudos
Message 16 of 26
(2,621 Views)

Unfortunately, apart from this error window that i'm attaching, there's nothing else I can tell you.  I am still encountering this problem.  i have attached the code as well. 

 

Looking at the block diagram for WTM Run, once the autoit reference is passed from the Main Interface, there is no problem until it hits the first invoke node.  After that, the error arises.  This error seems to be fixed once I re-open an open automation on the Main Interface (i.e. delete the old "open automation" block, and replace it with a new one).

 

Any help or idea on this would be great.  Thanks. 

Download All
0 Kudos
Message 17 of 26
(2,605 Views)

I did not get an error at the WinExists node when I ran your code. However, it seems I have a different version of AutoIt than the one you may have, since when I opened your code there was a broken arrow. The signature for ControlClick was different.

 

I suspect the problem you're running into is the same problem I discovered here. Note: You should wire a value to the "timeout" input for WinWaitActive.

 

Also, you really need to learn to stop using so many local variables. None of your local variables are necessary. Use wires!

0 Kudos
Message 18 of 26
(2,594 Views)

Hey smercurio_fc.  I made the changes you suggested, yet I'm still encountering the same problem, it keeps stoppnig with the same error message.  Could this be a system error?  I'm currently using AutoIt Version 3.  The Autoit Library I'm using is called AutoItX3 1.0 Type Library Version 1.0

 

The class I use in the automation open block is AutoItX3Lib.IAutoItX3.  Should I look into another version?  I'm also using LabView 8.6.

 

As I mentioned, I was encountering the same errors again, and this time to fix the errors, I had to get rid of the input terminal in the sub VI WTM Run and re-insert it, which then allowed the program to run again.  I haven't the slightest clue as to what's happening, there must be some discrepency with the reference values being passed. 

0 Kudos
Message 19 of 26
(2,587 Views)
I have AutoIt v3.2.12.1. As I indicated, I ran your code in a virtual machine with 8.6 installed and that version of AutoIt, and I did not get an error at that node. So, I would suggest downloading the latest version of AutoIt and see what happens. Note my previous comment about the signature for ControlClick being different. You will need to simply reselect that method where you're using it.
0 Kudos
Message 20 of 26
(2,584 Views)