Darren's Occasional Nugget 08/11/2008

Darren's Occasional Nugget 08/11/2008

Post by Darre » Wed, 13 Aug 2008 05:10:05


Hi all,For those of you who attended NI Week 2008 last week, I hope you all had a great time!  During my presentation on Thursday, I offhandedly mentioned a VI I wrote, and everybody in the room said they wanted it, so here it is.  Place this VI somewhere on disk where you'll remember you have it.  If you ever get in a situation where you have a modal VI that is running, and is in a state where you can't abort it, this VI should come in handy.  Navigate to this VI (attached below) in your file system and double-click on it.  The VI will launch (and will appear on top of your other modal VI), and you can select the offending modal VI in the ring and abort it:<img src=" http://www.yqcomputer.com/ "> Prior to writing this VI, I always had to resort to killing the LabVIEW.exe process and starting over...a massive headache if I had a bunch of VIs and probes open while debugging.  Anyway, I hope this VI comes in handy for some of you.  It works in LabVIEW 8.0 and later.  Unfortunately, since I'm using some private functionality to get information about VIs in memory, this VI is password-protected.-DP.S. - Check out past nuggets <a href="message?board.id=BreakPoint&message.id=1669" target="_blank"> here</a>. Message Edited by Darren on 08-11-2008 02:46 PM


Abort VI.vi:
http://www.yqcomputer.com/


abortvi.PNG:
http://www.yqcomputer.com/
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by muks » Wed, 13 Aug 2008 20:40:06

Hi darren,                  YEs this will defenitely be handy.Can you share as to how you have done that?

 
 
 

Darren's Occasional Nugget 08/11/2008

Post by dan_ » Wed, 13 Aug 2008 21:10:11

Thanks! I don't know how many times I had to terminate LabVIEW.exe because of this annoying feature... This helps a lot! Daniel
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by JoeLabVie » Wed, 13 Aug 2008 21:10:11

Thanks Darren for a very useful program.
 
It may not be helpful in a situation where there is a popup message that occurs in a loop, so every iteration of the loop causes another popup.  The interaction with the popup will prevent the operator from being able to select which VI to terminate.  Even when clicking on the popup message with the hope of "jumping" to the VI selection screen.
 
Is there a tweek that could be done to compensate for that situation?  
 
An example of such a situation is to have a 2D array (not transposed) that is wired to a Waveform Graph, where every iteration of the loop you get a popup message saying that there is "Not Enough Memory ... "
 

 
 
 

Darren's Occasional Nugget 08/11/2008

Post by Wieb » Wed, 13 Aug 2008 21:40:30

Darren,

I always use the AllVIsInMemory property, and it works just fine. Do you use
scripting to get the VI's from other contexts as well?

Regards,

Wiebe.
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by Ben » Wed, 13 Aug 2008 22:10:08

Thanks Darren.
But let me confess. These "secret" nuggets (password protected) are a little frustrating since all I can do is post winks and nods about how you did it. :smileymad:
Or should I just toss caution to the wind and and post what I know. :smileysurprised:
Until the day when LabVIEW Scripting is opened-up supported and documented,
"I know nothing!"  Sergent Shultz, Hogan's Heroes
Ben
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by tst » Wed, 13 Aug 2008 23:40:22

I posted code a quick example for how to do this <a href=" http://www.yqcomputer.com/ ;view=by_date_ascending&message.id=255759#M255759" target="_blank">here</a> (7.0). In that case, I built the VI into an executable and enabled VI server access on LabVIEW, so that I don't have the problem JLV mentioned with modal dialogs. To be honest, that quick example isn't exactly polished, but I left the EXE on my PC and I still use it occasionally when this happens to me. Just be sure to enable VI server access, or this won't work.
I never checked how this works in 8.x, with the multiple instances, but I expect that it should still work.
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by Steven » Thu, 14 Aug 2008 00:40:22

thanks Darren, and thanks for a good sesson last thursday :smileyhappy:
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by Darre » Thu, 14 Aug 2008 01:10:12

Ok, here's what the diagram looks like:<img src=" http://www.yqcomputer.com/ "> Off to the left of the diagram (not shown) is the private functionality I was talking about.  Basically, I have to get all the Application Instances where you might have VIs running...unfortunately, I don't think there's a way to do this without private VI Server properties.  Anyway, once I have all the Application Instances, I iterate over each of them and get the All VIs in Memory property.  I remove the "Abort VI.vi" from the list, in case it's running in one of these Application Instances.  Then, I open each VI Reference (with option '2' so that I open template VIs themselves instead of instances of them), and I check the Execution State of each VI.  If any VI is "Run top level", then I add its reference to an array.  Once I have done this for every Application Instance, I put the names of those VIs in the ring and let you choose which one you want to abort.I hope this helps,-DMessage Edited by Darren on 08-12-2008 11:08 AM


abort_vi_diagram.PNG:
http://www.yqcomputer.com/
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by JoeLabVie » Thu, 14 Aug 2008 01:40:20


I never checked how this works in 8.x, with the multiple instances, but I expect that it should still work.


I've been using a slightly modified version of your VI since you posted it.  It also works with LV8.x.  The one I use does not look for which one is running, it simply stops execution for any opened VI.  Thus, as you mentionned, it works for modal dialogs like the example I provided.
 
Thanks tsts. 
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by muks » Thu, 14 Aug 2008 15:10:08

Thanx for posting the screen shot of your block diagram darren.
 
 
 

Darren's Occasional Nugget 08/11/2008

Post by Wieb » Thu, 14 Aug 2008 23:17:16

> Off to the left of the diagram (not shown) is the private functionality I
was talking about.  Basically, I have to get all the Application
Instances where you might have VIs running...unfortunately, I don't think
there's a way to do this without private VI Server properties.

But if you are working one a project, there will only be VI's running in
your current application instances. So simply getting all VI's in memory
will do in most cases. At least it has been working for me. (I do a lot of
scripting, but never found the need to change my stop all VI).

Also, I simply stop all top level vi's. Guess it's a 'poor mans' solution.
(If I'd make my stop all VI more flexible, I'll never learn not to make VI's
modal untill testing is done.)

Another great use for VI's like this is to stop dynamic VI's started with VI
server.

Regards,

Wiebe.