PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling Windows applications through simulated key and mouse strokes

Has anybody an example program for controlling a Windows application from LabVIEW through simulated keystroke and mouse commands? I want to select a menu item inside that Windows application (which is not from Microsoft).
Thanks.
0 Kudos
Message 1 of 7
(7,917 Views)
Hello Pbuerki,

Thank you for contacting National Instruments.

Below is a link to an example which uses simulated keystrokes to control Notepad.

http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=D0D28C07468931C1E034080020E74861&p_node=%20DZ53002&p_submitted=N&p_rank=&p_answer=&p_source=Internal

I hope this helps,

Sean C.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(7,916 Views)
Sorry, this is a bad link.
In the meantime, I have played around with the simulate keyboard.vi from your database. It works fine, until I want to simulate the input of a character like :\, etc. Do you know how I could get it to simulate these characters as well?
Thanks.
Message 3 of 7
(7,916 Views)
Hello Pbuerki,

I apologize for the bad link.

Your VI works well. I have added the characters you were missing into your Virtual Key menu control. The following link leads to Microsoft's support page.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp

This page lists all the possible virtual keys and their corresponding hex codes. To add them I simply right clicked on the control and selected Edit Items...
Then enter the key label in the Labels column and the key hex code in the Values column.
Keep in mind that in order to simulate a "?" or any character that requires the shift key, you will have to "press and hold" the virtual shift key, then "press and
release" the "/" key, and finally "release" the virtual shift key.

I have also modified your VI to open notepad in order to display the virtual keys.

I hope this helps,

Sean C.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(7,916 Views)
Hi Sean,
Thank you for your reply and attachments. The vi that you sent me
requested the Move Window to Top.vi, which I do not have. After
deleting this part of the program, it worked fine. Would you send me
this sub-vi as well?
In the meantime, I have written a user-friendly Virtual Keyboard.vi,
which provides more functionality than the example programs I found in
the developer zone. As it is based in part on your input and some
materials I found in the developer zone, I uploaded the vi for others
to use.
Thanks again for your time and help.
Peter
Message 5 of 7
(7,916 Views)
Hello Pbuerki,

Attached is the requested VI.

Have a great day,

Sean C.
Applications Engineer
National Instruments
Message 6 of 7
(7,917 Views)
Works great.
Thx for that.

Message Edited by NewOne on 08-17-2005 07:55 AM

0 Kudos
Message 7 of 7
(7,645 Views)