Showing results for 
Search instead for 
Did you mean: 

How to make a file explorer work under certain conditions

Good afternoon,


I have built a VI that is basically a file explorer that lets you import data to another application, when a button is clicked, you can navigate throught the directories of your pc searching for a txt file to import and plot some ghraphs. I used the property node "Visible" to show up this file explorer as a window, so every time i click the button, it shows up, but I realize it is processing even if its not being used, like a process running in second plan, thats why I want to make it different, I want to make it run only when the button aforementioned is on true, and to make it I have tried stuff like wiring the button to the loop condition, using a case structure with the button wired and nothing seems to work. How could I do that?


I appreciate your help,



Lucas Faquim
0 Kudos
Message 1 of 5

Okay a couple things.  You should never wire a false to a while loop, unless you are on an embedded device, like an FPGA.  If you do this your code will never stop running.  Sure you can stop it with an abort, but you can also stop your car by crashing it into a tree.  If the goal is to stop then this works.  But most people value their cars, and you should value your data.  Create a cleanup routine that gets called on quit.


It is hard to give good advice because I don't know the full picture, but I'm guessing you are calling this VI asyncronously and then showing or hiding when you want.  A simple solution is in the timeout of your VI, check to see if the window is being shown.  If it isn't then don't process the data.  Also are you expecting the file to change while running?  If not then just process the data on value change from the user.

0 Kudos
Message 2 of 5

First of all, thank you for your answer, Hooovahh. I am not an expert programmer, I really dont know the problems around the infinite loop, and dont know what are the issues around thhe abort execution, could you tell me? Anyways, I dont expect the file to change, and I already tried to build this file explorer inside an event struct., the problem is that it only executes once, I mean, when you double click a cell of the MC Listbox, it won't take you to the next directory. The way its built now, its working properly, there are no problems on making it visible or invisible, its just that I think its consuming computer resourses when its not necessary.


I want to take this opportunity to ask for some advanced tutorials for labview, mostly in this part of knowledgement, how to make the best use of the computer resourses.


Ty you for your attention and time, I am waiting for your answer,

Lucas Faquim
0 Kudos
Message 3 of 5

Here are a few community examples with a powerpoint describing LabVIEW performance and memory management.


One of the more useful tools is the VI profiler


About the abort, you always want your program to shut down gracefully, aborting your LabVIEW application can be very bad especially if you are connected to hardware that requires some shutdown procedure.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 5

@Faquim wrote:

First of all, thank you for your answer, Hooovahh. I am not an expert programmer, I really dont know the problems around the infinite loop, and dont know what are the issues around thhe abort execution, could you tell me?

To understand this idea, think of yourself as a VI.  You're sent to cook a full meal in the kitchen.  This meal is complex enough it'll require several burners, the sink, a cutting board, and trips to the fridge and cupboards.  I tell you to start cooking and you go about your business getting things going.  At some point, I come in and drag you out of the kitchen and don't allow you to go back.  What state is the kitchen in?  Is the fridge open?  Is the freezer open?  Are the burners on?  Is the oven on?  Is the oven closed?  Will things on the stove boil over creating a mess and potentially a fire?  Who knows?  You're creating the same mess when you hit the abort button.  You're forcing yourself into an uncertain situation that may cause more problems than taking the thirty seconds it'd take to turn your burners off, turn off the oven, and close the fridge door.  You WANT to have a cleanup routine in case things need to stop similar to getting the kitcen into a safe state before leaving.


With an embedded system, there isn't the typical user interface so if it stops, it's likely stopped for a LONG time.  These typically run infinitely until something goes wrong and they shut themselves down.  When you can put a stop button on the front panel and use that, it makes worlds more sense than leaving the kitchen in disarray.

0 Kudos
Message 5 of 5