Jump to content


Photo
- - - - -

Getting Active VI


  • Please log in to reply
9 replies to this topic

#1 Jon Kokott

Jon Kokott

    Very Active

  • Members
  • PipPipPip
  • 176 posts
  • Location:Milwaukee, WI
  • Version:LabVIEW 2010
  • Since:2006

Posted 23 February 2011 - 03:12 PM

When launching a tool from the tools menu option of a given VI (tool residing in the labview 2010/project directory)

How do I get the VI that activated the tool?

Currently I'm using App.VIOfTopBD, but this does not always return the right VI if the block diagram wasn't the last one open.

I'd rather not monitor every activated VI with some sort of a daemon (similar to what is done on the sub VI fixer script engine)
(I prefer not to launch any tools at start, trying to run as lean as possible.)

~Jon
Certified LabVIEW Architect

#2 François Normandin

François Normandin

    Son of Scotland

  • Premium Member
  • 1,081 posts
  • Location:Montréal, QC
  • Version:LabVIEW 2012
  • Since:1999

Posted 23 February 2011 - 03:16 PM

That would be the Application:MenuLaunch:VI

Attached File  App_MenuLaunch_VI.vi   5.07K   122 downloads (LV2009)

François [frɑ̃swa], CLA


#3 Jon Kokott

Jon Kokott

    Very Active

  • Members
  • PipPipPip
  • 176 posts
  • Location:Milwaukee, WI
  • Version:LabVIEW 2010
  • Since:2006

Posted 23 February 2011 - 03:19 PM

That would be the Application:MenuLaunch:VI

Attached File  App_MenuLaunch_VI.vi   5.07K   122 downloads (LV2009)


Thanks,

this is not present normally, the only way I was able to get to it was through a copy paste method.

~Jon
Certified LabVIEW Architect

#4 smenjoulet

smenjoulet

    Very Active

  • Premium Member
  • 125 posts
  • Location:Dallas, TX
  • Version:LabVIEW 2010
  • Since:1992

Posted 23 February 2011 - 03:21 PM

That would be the Application:MenuLaunch:VI


Darn, you're quick! :D

Congratulations on 1000 popsts!

-Scott
Simple <> Easy. Just because it may be simple, does not mean it is easy!

#5 Yair

Yair

    Extwemely Active

  • Members
  • PipPipPipPipPipPip
  • 2,644 posts
  • Version:LabVIEW 2009
  • Since:2003

Posted 23 February 2011 - 03:23 PM

Note that you should also use the application reference to account for the possibility of the VI loading in another instance:

LaunchVI.png


The properties are private (indicated by the brown color and documented in their context help), which is why you can't see them.

#6 Jon Kokott

Jon Kokott

    Very Active

  • Members
  • PipPipPip
  • 176 posts
  • Location:Milwaukee, WI
  • Version:LabVIEW 2010
  • Since:2006

Posted 23 February 2011 - 03:29 PM

Note that you should also use the application reference to account for the possibility of the VI loading in another instance:

LaunchVI.png


The properties are private (indicated by the brown color and documented in their context help), which is why you can't see them.


could you send the VI for that. (that property is also a super secret public)

I am aware of application instance, however, I was using a significantly more convoluted method involving getting the last active bd to owning application.

~Jon
Certified LabVIEW Architect

#7 smenjoulet

smenjoulet

    Very Active

  • Premium Member
  • 125 posts
  • Location:Dallas, TX
  • Version:LabVIEW 2010
  • Since:1992

Posted 23 February 2011 - 03:31 PM

could you send the VI for that. (that property is also a super secret public)


Refer to the bottom of this post to see how to enable the private properties/methods.
Simple <> Easy. Just because it may be simple, does not mean it is easy!

#8 Jon Kokott

Jon Kokott

    Very Active

  • Members
  • PipPipPip
  • 176 posts
  • Location:Milwaukee, WI
  • Version:LabVIEW 2010
  • Since:2006

Posted 23 February 2011 - 03:38 PM

Refer to the bottom of this post to see how to enable the private properties/methods.


Correct me if I'm wrong,

I have all scripting features enabled (as far as I can see)

the supersecretestuff=true flag hasn't done anyting in a lone time.

The origins of that property are likely that it was leaked from the NI alliance member "stuff" (whatever that is)

~Jon
Certified LabVIEW Architect

#9 François Normandin

François Normandin

    Son of Scotland

  • Premium Member
  • 1,081 posts
  • Location:Montréal, QC
  • Version:LabVIEW 2012
  • Since:1999

Posted 23 February 2011 - 03:41 PM

could you send the VI for that. (that property is also a super secret public)

I am aware of application instance, however, I was using a significantly more convoluted method involving getting the last active bd to owning application.

~Jon


Install this package from JG. It's a repack from Aitor's Scripting Workbench.

You'll have all the super secret stuff you need at the tips of your mouse: Tools menu.

Darn, you're quick! :D

Congratulations on 1000 popsts!

-Scott


thanks. :cool:

François [frɑ̃swa], CLA


#10 smenjoulet

smenjoulet

    Very Active

  • Premium Member
  • 125 posts
  • Location:Dallas, TX
  • Version:LabVIEW 2010
  • Since:1992

Posted 23 February 2011 - 03:53 PM

Correct me if I'm wrong,

I have all scripting features enabled (as far as I can see)

the supersecretestuff=true flag hasn't done anyting in a lone time.


There were two ini keys, one for scripting and one for additional private features. True the scripting key hasn't worked for some time as NI switched to requiring activation for scripting and then making it publically available as option that can be an enabled.

The other key still works for some of the additional private items. However the scripting workbench that Francois points to may be a better option for you depending on your needs.
Simple <> Easy. Just because it may be simple, does not mean it is easy!