LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

limiting directory user can open

Is it possible to limit the directory a user can open using the File Dialog (or similar) vi? I want the user to be able to read from,and write to, a file for loading the data to/from a PC, but only want the user to be able to do it from an external floppy drive. Baseline files exist on the PC that I do not want the user to overwirte. It seems you can use the File function to allow the user to start at a directory that you want, but once this function opens, the user can then browse to anywhere on the PC. Can this browsing be limited to only specific directories?
Thanks.
0 Kudos
Message 1 of 4
(2,782 Views)
I don't think it is possible with the standard file browser. It is a standard windows component and a user can read or write to folders according to the security permissions of the operating system.
0 Kudos
Message 2 of 4
(2,782 Views)
dave h wrote in message news:<50650000000800000076020100-1079395200000@exchange.ni.com>...
> Is it possible to limit the directory a user can open using the File
> Dialog (or similar) vi? I want the user to be able to read from,and
> write to, a file for loading the data to/from a PC, but only want the
> user to be able to do it from an external floppy drive. Baseline files
> exist on the PC that I do not want the user to overwirte. It seems you
> can use the File function to allow the user to start at a directory
> that you want, but once this function opens, the user can then browse
> to anywhere on the PC. Can this browsing be limited to only specific
> directories?
> Thanks.

You have two options: 1. Write your own File Dialog VI, or 2. U
se the
built-in one and then check the result, if the user has selected
anything other than 'A:', loop back and force the user to select
again.

Paul Cardinale
0 Kudos
Message 3 of 4
(2,782 Views)
BEWIN is correct in his response: the file browser used in LabVIEW is a standard Windows component tied to the operating system's security permissions. However, through the power of LabVIEW this can be overcome.

Attached below, you will find a VI that I wrote in LabVIEW 7.0 which allows a user to specify a root path and select a file under that root path. The VI then returns the selected file. It prohibits a user from browsing in any directory outside the root path and acts as a protected version of the File Dialog VI.

Some information about specifics to this program:
1) Only a file can be returned; a selected directory gets stepped into rather than returned.
2) If "Parent Directory" is selected while in the specified root directory, the VI remain
s in the root directory (this is the protection feature).
3) A user is not permitted make any selections in an empty directory; they must go back to the parent directory or quit.
4) If the VI is quit before a file is selected, is returned.

All of these attributes can be easily modified in the block diagram.

Eric Sulzer
Applications Engineer
National Instruments
http://www.ni.com/ask
E. Sulzer
Applications Engineer
National Instruments
Message 4 of 4
(2,782 Views)