Overview
This VI demonstrates how to keep trying opening a file until it becomes available or you gain proper permission to open the file, or if a timeout occurs
Description
This example shows one way to check a file to see if it is opened and wait until it is available to be opened. It should also work with permissions and other file related activities. This may not be always necessary, however, it can be while using ActiveX calls or abnormal file access.
Requirements
LabVIEW 2012 (or compatible)
Steps to Implement or Execute Code
1. Download the folder "Wait to Open File_LV2012_NI Verified"
2. Open the VI "Wait To Open file_LV2012_NI Verified"
3. Enter the name of the file Test.txt; browse to the location where this VI is stored and right-click the properties of the Test.txt file to make sure the access mode for this document is set to read-only
4. Choose the operation mode: Open or create
5. Set the access mode to read/write
6. Set the time to wait to 30 seconds and above
7. Run the VI
8. While it is running, browse to the location of the file, right-click on it and open its properties, then uncheck read-only from attributes and click on apply.
9. If the VI stopped before you could perform step 6, increase the time to wait and repeat steps 5 and 6
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.