LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get LabView to prompt the user to before writing over a tif file?

When I want to save a tif file the program I have made will overwrite an existing file.  I want it to prompt me before writing over a file.  Does anyone know how to do this?  Thanks
0 Kudos
Message 1 of 7
(3,215 Views)

Are you using normal file open, write, close functions or are you using VISA functions?

Post your code to help further.

Mathan

0 Kudos
Message 2 of 7
(3,214 Views)

There are a couple of ways to do this.

1.  Before writing to the file, check to see if the file exists.  Wire the boolean result to a Case Structure and handle asking if you want to overwrite the file using a message popup.  Then the boolean output of the popup will decide if you want to overwrite or not, and maybe offer to rename the file, etc..  as you want to handle that. 

2.  A better way is to use the feature already available with most file write functions (vi's).  If you use the Context Help (under Help menu or click on questionmark at upper right corner), you can get additional description of the terminals on the connector pane of the function.  Most will offer a boolean to automatically replace file.  If you select not replacing the file automatically, it should provide a prompt asking if you want to replace the file.  I can't remember if it offers to change the path name.. Unfortunately, I do not have LV installed on this machine so I cannot verify this.

RayR

0 Kudos
Message 3 of 7
(3,208 Views)
There is an example called Write-Read Text File that ships with LabVIEW that uses the open/create/replace file function. You can use the function along with a case structure to create a popup dialog box to overwrite or not.
Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 4 of 7
(3,184 Views)
Thanks for the input, I will try some of your suggestions.
0 Kudos
Message 5 of 7
(3,178 Views)
The image VI's do not prompt if the file already exisits, it simply overwrites the file, so option 1 is better.
 
Look at the image below for an example at how to implement.  It uses LV8.2.
 
RayR
 


The False case simply runs the path and error cluster straight through.

Message Edited by JoeLabView on 05-21-2008 09:33 PM
0 Kudos
Message 6 of 7
(3,172 Views)

Here is the code in LV8.2.

 

0 Kudos
Message 7 of 7
(3,168 Views)