Example Code

Capture All Keystrokes in an Active VI

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

Capture every alphanumeric key that is pressed in the keyboard.

 

Description
It may be useful in an application to capture all keystrokes that are pressed during the execution of a VI. This may be useful for creating logs or other such information, as well as populating a control regardless of whether or not it has key focus. This can be accomplished by using the "Key Down" event, and interpreting the data to be a particular ASCII character.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

1. Run the VI
2. Type any message with the keyboards
3. Change to second tab and keep typing
4. Get back to the first tab
5. Finish the execution with the Stop button

 

Additional Information or References

Snippet.png

Wes Pierce
Principal Engineer
Pierce Controls

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.