- Timestamp:
- Feb 3, 2009 4:38:28 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/WriteUSANSData.ipf
r472 r473 53 53 if(dialog) 54 54 PathInfo/S catPathName 55 fullPath = DoSaveFileDialog("Save data as")55 fullPath = U_DoSaveFileDialog("Save data as") 56 56 If(cmpstr(fullPath,"")==0) 57 57 //user cancel, don't write out a file … … 199 199 End 200 200 201 201 // returns the path to the file, or null if the user cancelled 202 // fancy use of optional parameters 203 // 204 // enforce short file names (26 characters) 205 //DUPLICATE of similar-named function in WriteQIS (including starts a bad dependency cascade) 206 Function/S U_DoSaveFileDialog(msg,[fname,suffix]) 207 String msg,fname,suffix 208 Variable refNum 209 // String message = "Save the file as" 210 211 if(ParamIsDefault(fname)) 212 // Print "fname not supplied" 213 fname = "" 214 endif 215 if(ParamIsDefault(suffix)) 216 // Print "suffix not supplied" 217 suffix = "" 218 endif 219 220 String outputPath,tmpName,testStr 221 Variable badLength=0,maxLength=26,l1,l2 222 223 224 tmpName = fname + suffix 225 226 do 227 badLength=0 228 Open/D/M=msg/T="????" refNum as tmpName 229 outputPath = S_fileName 230 231 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename 232 if(strlen(testStr)==0) 233 break //cancel, allow exit 234 endif 235 if(strlen(testStr) > maxLength) 236 badlength = 1 237 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?" 238 if(V_flag==3) 239 outputPath = "" 240 break 241 endif 242 if(V_flag==1) //my suggested name is OK, so trim the output 243 badlength=0 244 l1 = strlen(testStr) //too long length 245 l1 = l1-maxLength //number to trim 246 //Print outputPath 247 l2=strlen(outputPath) 248 outputPath = outputPath[0,l2-1-l1] 249 //Print "modified ",outputPath 250 endif 251 //if(V_flag==2) do nothing, let it go around again 252 endif 253 254 while(badLength) 255 256 return outputPath 257 End
Note: See TracChangeset
for help on using the changeset viewer.