Discussion:
Darren's Occasional Nugget 08/11/2008
(too old to reply)
Darren
2008-08-11 20:10:05 UTC
Permalink
Hi all,For those of you who attended NI Week 2008 last week, I hope you all had a great time!&nbsp; 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.&nbsp; Place this VI somewhere on disk where you'll remember you have it.&nbsp; 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.&nbsp; Navigate to this VI (attached below) in your file system and double-click on it.&nbsp; 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="Loading Image..."> 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.&nbsp; Anyway, I hope this VI comes in handy for some of you.&nbsp; It works in LabVIEW 8.0 and later.&nbsp; 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&amp;message.id=1669" target="_blank"> here</a>. Message Edited by Darren on 08-11-2008 02:46 PM


Abort VI.vi:
http://forums.ni.com/attachments/ni/170/348423/1/Abort VI.vi


abortvi.PNG:
http://forums.ni.com/attachments/ni/170/348423/2/abortvi.PNG
muks
2008-08-12 11:40:06 UTC
Permalink
Hi darren, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; YEs this will defenitely be handy.Can you share as to how you have done that?
tst
2008-08-12 14:40:22 UTC
Permalink
I posted code a quick example for how to do this <a href="http://forums.ni.com/ni/board/message?board.id=170&amp;view=by_date_ascending&amp;message.id=255759#M255759" target="_blank">here</a>&nbsp;(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.
JoeLabView
2008-08-12 16:40:20 UTC
Permalink
tst wrote:

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.&nbsp; It also works with LV8.x.&nbsp; The one I use does not look for which one is running, it simply stops execution for any opened VI.&nbsp; Thus, as you mentionned, it works for modal dialogs like the example I provided.
&nbsp;
Thanks tsts.&nbsp;
Wiebe@CARYA
2008-08-12 12:40:30 UTC
Permalink
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.
Ben
2008-08-12 13:10:08 UTC
Permalink
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!" &nbsp;Sergent Shultz, Hogan's Heroes
Ben
dan_u
2008-08-12 12:10:11 UTC
Permalink
Thanks! I don't know how many times I had to terminate LabVIEW.exe because of this annoying feature... This helps a lot! Daniel
JoeLabView
2008-08-12 12:10:11 UTC
Permalink
Thanks Darren for a very useful program.
&nbsp;
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.&nbsp; The interaction with the popup will prevent the operator from being able to select which VI to terminate.&nbsp; Even when clicking on the popup message with the hope of "jumping" to the VI selection screen.
&nbsp;
Is there a tweek that could be done to compensate for that situation?&nbsp;&nbsp;
&nbsp;
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 ... "
&nbsp;
R&nbsp;
StevenA
2008-08-12 15:40:22 UTC
Permalink
thanks Darren, and thanks for a good sesson last thursday :smileyhappy:
Darren
2008-08-12 16:10:12 UTC
Permalink
Ok, here's what the diagram looks like:<img src="Loading Image..."> Off to the left of the diagram (not shown) is the private functionality I was talking about.&nbsp; 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.&nbsp; Anyway, once I have all the Application Instances, I iterate over each of them and get the All VIs in Memory property.&nbsp; I remove the "Abort VI.vi" from the list, in case it's running in one of these Application Instances.&nbsp; 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.&nbsp; If any VI is "Run top level", then I add its reference to an array.&nbsp; 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://forums.ni.com/attachments/ni/170/348694/1/abort_vi_diagram.PNG
muks
2008-08-13 06:10:08 UTC
Permalink
Thanx for posting the screen shot of your block diagram darren.
Wiebe@CARYA
2008-08-13 14:17:16 UTC
Permalink
Post by Darren
Off to the left of the diagram (not shown) is the private functionality I
was talking about.&nbsp; 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.

Loading...