LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

controlling an old windows program from LabVIEW or CVI

I want to control a windows program, by emulating button clicks and text entries to the other program, from LavVIEW or LabWindows/CVI. How can this be done?
0 Kudos
Message 1 of 4
(3,330 Views)


Hi,

LabVIEW itself doesn't have built-in features that will let you simulate keyboard entries and clicks, as you may have figured out. This can however be achieved by using a combination of tricks and techniques.

Firstly, simulating keyboard entries is much easier than mouse-clicks. You can use Windows' shell scripting to issue various commands -- the AppActivate command to activate your application. And then there's the SendKeys command which simulates keystrokes.

Second response on the following thread has such example scripts and other details:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000C2860000&UCATEGORY_0=_9_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=sendkey&USEARCHCONTEXT_Q
UESTION_S=0

You can run these and such scripts from within LabVIEW using the SystemExec VI. In fact you can generate the script on the fly using string functions in LabVIEW, if you wish.

Secondly, the following thread has a simulate_keyboard VI which directly calls into Windows DLL to simulate keyboard entries. You may use this VI as well to generate keystrokes.

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000009DBE0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=sendkey&USEARCHCONTEXT_QUESTION_S=0

Hope this gives you some ideas.

Khalid


0 Kudos
Message 2 of 4
(3,330 Views)

khalid

 

these links dont work?

 what are they now?

 

regards

0 Kudos
Message 3 of 4
(2,977 Views)
Khalid last logged into the forums in July, and it's not likely that he would be monitoring a 4-year old thread. Since that post the NI site has been reorganized, and old links don't work. In terms of using SendKey, search the forum and you'll find examples. Such as this one. You may also want to consider a third-part application for controlling applications. My favorite is AutoIt. You can search the forum to find examples for this as well. Such as this one.
0 Kudos
Message 4 of 4
(2,951 Views)