Example Code

Simple Idle Timer using LabVIEW

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

1. Overview:

This VI performs a countdown before killing the execution of the application set as parameter


2. Description: 

Say you are a volume license administrator, and your users keep forgetting to quit LabVIEW when they are done using it.  This causes other users to complain that there aren't any licenses available.  Since VLM won't register a license as unused until LabVIEW is closed, it might be useful to have some type of application that reminds users to close LabVIEW or checks if they are active at their computer.  This is as simple example to demonstrate how someone might get started writing an application along those lines.

 

This VI prompts a user to renew a license, resets a timer if they choose Renew License or quits LabVIEW if they choose Release.

 

I chose to use the command line to terminate rather than the Quit LabVIEW VI to make it useful for more applications than LabVIEW.  The change is easy if you would prefer to have the application only for LabVIEW and don't want to invoke a command prompt.

   

3. Requirements

  • LabVIEW 2012 (or compatible)

4. Steps to Implement or Execute Code

  1. Open LabVIEW Idle Timer VI.
  2. Choose amount of time before "Idle"
  3. Adjust process to terminate if necessary.
  4. Run the VI.
  5. Once the time elapses, the process will be killed

5. Additional Information or References

This example is set up by default to terminate notepad.exe, as the source code will be running in LabVIEW.  Since this VI can be used to terminate any process, the user can change the process to terminate to labview.exe once they compile to an executable.

 

VI Front Panel

Front Panel.JPG  

 **This document has been updated to meet the current required format for the NI Code Exchange.** 

Ben

National Instruments
Certified LabVIEW Associate Developer
Certified TestStand Developer

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