LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to limit the save to only new files and not rewrite over old

I am creating a user interface and now need to save files.  I want the user to input a name that does not exist, and not have the capability to rewrite over old files.  So I have used the "file dailog" box and indicated only new files in the properties window, however if i enter the name of an existing file it automatically asks if I want to replace it.   I would like not to give this ability to the user, any ideas?
 
Thanks
 
Reza_Sed
0 Kudos
Message 1 of 5
(3,051 Views)
One solution:
 
Set the file dialog to "new or existing" and place it inside a while loop, then use the "exists?" output and wire it to the loop termination terminal (set to "continue if true"). Now it will just pop up another file dialog when the file exists.
 
Of course you should add some logic to also exit the while loop if the dialog is canceled.
0 Kudos
Message 2 of 5
(3,043 Views)

Yeah I am using something similar now but I was just hoping for a simple message saying you can only pick new files instead of re-popping up the save dialog box

Thanks

Reza Sed

0 Kudos
Message 3 of 5
(3,042 Views)
Well, if you're in the loop and you see the file exists, then pop up your own dialog box stating that they can only create new files, then redisplay the open dialog.
0 Kudos
Message 4 of 5
(3,028 Views)
Well, LabVIEW can only look at the output once the file dialog returns. The file dialog is a system service. How would you suggest it should handle the situation when a user accidentally types a name that already exists in a huge folder? Should it just beep at him? Lock the "Open" button? I think it should be up to your own code to decide if the filename is acceptable. Popping a new file dialog if the name is not acceptable seems like the natural thing to do. 🙂
 
If you have unlimited time to waste, I am sure you could make your own custom "file dialog" by designing a VI that looks and acts identical to the system VI, but constantly compares the entered text with the list of files and e.g. locks the OK button, beeps, and flashes a red LED if the entered name already exists. :o.
 
 
0 Kudos
Message 5 of 5
(3,023 Views)