LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

asynchronous file move

Hi,
I want to modify  vi, in which one of the cases does a simple file move.  It is moving video files, and in some cases they can be fairly large, in which case the vi halts until the move is complete. I want to modify it if possible to start the move, but have the parent vi continue to execute while the move is happening.  I do want to maintain error cluster info and error handling of the move itself.  I'm wondering what the best approach is.

My current idea is to create another vi in which the contents is nothing but the move, get a reference to this vi, and launch it asynchronously using the vi reference.  It can have the error handler vi within it to catch errors.  Is there a better approach anyone else has used?

Thanks
David Jenkinson
0 Kudos
Message 1 of 4
(2,892 Views)
This is a reasonable approach. However, once you launch the VI dynamically you will need to have the File Move VI notify the main VI of any errors. The error I/O that you get from the VI Server functions will basically tell you whether it was launched successfully. Since you won't want to wait until the subVI is done you will need to invoke the VI with "Wait until completion" set to False. This means the subVI-launching VI will return immediately.

There may be other ways, depending on the structure of your program. For instance, if you're using a state machine you can have the file write out in small chunks. All you would need to do is to return to that state to write out the next chunk. You can keep track of where you are in the file using a shift register.
0 Kudos
Message 2 of 4
(2,877 Views)
Hi David,

in general your idea is the way to go...

I would prefer to run a vi in parallel (just start it from your main vi) and send the move-commands by using a queue. But the general scheme is the same...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(2,876 Views)
Thanks for great suggestions all,
Regards,
Dave
0 Kudos
Message 4 of 4
(2,862 Views)