LabVIEW Project Providers

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the item that launched Global_OnCommand

Hi,

I would like to get hold of the item that launched the Global_OnCommand. Was it a VI, Project, LV Class etc. I also would like to get a reference to the item in order to find its path and also application instance. I would like to add functiolity that I have in the project environment with right-click and menues etc. to the toolbar.

Is there a way to do this? The "Command" input is of course know, but whatabout the "object" U64 reference. How can this be used? I can't seem to find any API VI that works with this one. In the examples this "object" is unused.

I have used "App.MenuLaunchVI" and "App.MenuLaunchApp" to get the VI name and application of a launcher VI, but I would like a more general approach what works with projects, VIs, lvclass and lvlib and all kind of items outside the "project environment".

Any idea?

Thanks,

Mattias

0 Kudos
Message 1 of 5
(3,112 Views)

Mattias,


Sorry for the delay here, I just am getting through my backlogs of email from being out of town.  I played around with this for a while this afternoon but couldn't figure anything out immediately.  I'll keep investigating and check with the team here and see if anyone has other ideas and get back to you.

David

0 Kudos
Message 2 of 5
(3,068 Views)

Sorry for the delay, but I had to do some investigation before I could find an answer.  It turns out that there is not one simple property or VI that will return the reference to the item of the active window in all cases.  However, using some VI Server Wizardry, I was able to come up with some logic that would determine what type of window calls it and return it's reference. 


Caveats:

  • This will only determine if it's a VI, Project or Library.  We would need to figure out some similar logic if you are looking for a different type of window.
  • I haven't fully tested it so there may be instances when it doesn't perfectly work
  • There is one private node used (GetActiveVIRef method) because there was no public function that worked in the provider context.  Use the same caution with this as any other untested functions in LabVIEW. 
  • Please excuse my sloppy diagram style, I tried to make it as neat as possible without having to make subVIs
  • It's saved in LabVIEW 2012 because it is difficult to save for previous for provider VIs.  Let me know if you need it saved for an older version, and I'll be happy to.

Let me know if this works for your needs.

David

0 Kudos
Message 3 of 5
(3,068 Views)

Hi,

Thanks, I will try. If it would be possible to get it in LV2009 it would be great since we are still supporting this version (for the last time hopefully)?

Mattias

0 Kudos
Message 4 of 5
(3,068 Views)

You got it.  I didn't have 2009 to test it, but it works in 2010 (with a minor modification due to the new Getting Started Window file name) so I expect it should work in 2009 as well.  Let me know if you run into problems.


David

0 Kudos
Message 5 of 5
(3,068 Views)