Developer Center Resources

cancel
Showing results for 
Search instead for 
Did you mean: 

Example: Get VI Information from a Menu Item

 

» Creating a Development Tool » Integrating into the LabVIEW Menus » Get VI Information

 

Integrating into the LabVIEW Menus illustrates how custom menu items can be created in LabVIEW.  Many times, it is advantageous for a custom menu item to see which VI was open when it was launched.  In this example, the VI GetInfo returns the reference of the VI that was open when it was launched.

 

Requirements: LabVIEW 2009

Instructions

 

  1. Download GetInfo.vi (or save the PNG snippet).
  2. Place the VI in ...LabVIEW 2009\project\
  3. Restart LabVIEW 2009.
  4. Open any VI
  5. Select Tools » GetInfo...
  6. GetInfo.vi is launched, and retrieves the information from VI (opened in step 4)

GetInfo.png

VI Details

 

  1. Menu Launch VI Information.vi (available in LabVIEW 2009) returns the Application reference and VI Name for the VI which was active when this menu item was launched.  It is available in labview\vi.lib\VIServer.
  2. Open VI Reference uses the Application reference and VI Name obtained to open a VI reference.
  3. A VI property node is used to return two simple VI properties: Path and Description.  Any VI property or methods could be used here.  For example, Scripting could be used to inspect or modify the calling VI.

 

Chris Bolin
LabVIEW Partner Program, CLA
Comments
James@Work
Member
Member
on

Can anyone point me to any information on why the subVI "Menu Launch VI Information.vi" that's used here might be returning error 42 for

Property Node (arg 1) when I use it inside a VI that is launched from the LabVIEW File menu?

I am trying to get the Application reference and it's evidently not available/valid?

However, this generic error code doesn't provide any details on the problem.

 

EDIT:  OK, once I slowed down to actually read the help...

 

Menu Launch VI Information Help.png

 

The context help clearly states "... a VI from which a Tools menu option..." and so I'm assuming this VI will not work for a VI launched from the File menu.  So, my new question is whether there is similar functionality that works from the File menu?

/Edit

 

Thanks in advance for any suggestions.

 

James

Tech Advisor - Automation
LabVIEW 5.0 - 2020