Changeset 474
- Timestamp:
- Feb 3, 2009 4:45:55 PM (14 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/WriteModelData_v40.ipf
r473 r474 84 84 if(dialog) 85 85 PathInfo/S catPathName 86 fullPath = A_DoSaveFileDialog("Save data as",fname=NameofWave(ywave)+".txt")86 fullPath = DoSaveFileDialog("Save data as",fname=NameofWave(ywave)+".txt") 87 87 If(cmpstr(fullPath,"")==0) 88 88 //user cancel, don't write out a file … … 101 101 End 102 102 103 // returns the path to the file, or null if the user cancelled104 // fancy use of optional parameters105 //106 // enforce short file names (26 characters)107 // DUPLICATE of similar-named function in WriteQIS (including starts a bad dependency chain)108 Function/S A_DoSaveFileDialog(msg,[fname,suffix])109 String msg,fname,suffix110 Variable refNum111 // String message = "Save the file as"112 113 if(ParamIsDefault(fname))114 // Print "fname not supplied"115 fname = ""116 endif117 if(ParamIsDefault(suffix))118 // Print "suffix not supplied"119 suffix = ""120 endif121 122 String outputPath,tmpName,testStr123 Variable badLength=0,maxLength=26,l1,l2124 125 126 tmpName = fname + suffix127 128 do129 badLength=0130 Open/D/M=msg/T="????" refNum as tmpName131 outputPath = S_fileName132 133 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename134 if(strlen(testStr)==0)135 break //cancel, allow exit136 endif137 if(strlen(testStr) > maxLength)138 badlength = 1139 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?"140 if(V_flag==3)141 outputPath = ""142 break143 endif144 if(V_flag==1) //my suggested name is OK, so trim the output145 badlength=0146 l1 = strlen(testStr) //too long length147 l1 = l1-maxLength //number to trim148 //Print outputPath149 l2=strlen(outputPath)150 outputPath = outputPath[0,l2-1-l1]151 //Print "modified ",outputPath152 endif153 //if(V_flag==2) do nothing, let it go around again154 endif155 156 while(badLength)157 158 return outputPath159 End -
sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf
r454 r474 825 825 return(str) 826 826 End 827 828 829 //returns the path to the file, or null if cancel 830 Function/S DoOpenFileDialog(msg) 831 String msg 832 833 Variable refNum 834 // String message = "Select a file" 835 String outputPath 836 837 Open/D/R/T="????"/M=msg refNum 838 outputPath = S_fileName 839 840 return outputPath 841 End 842 843 // returns the path to the file, or null if the user cancelled 844 // fancy use of optional parameters 845 // 846 // enforce short file names (26 characters) 847 Function/S DoSaveFileDialog(msg,[fname,suffix]) 848 String msg,fname,suffix 849 Variable refNum 850 // String message = "Save the file as" 851 852 if(ParamIsDefault(fname)) 853 // Print "fname not supplied" 854 fname = "" 855 endif 856 if(ParamIsDefault(suffix)) 857 // Print "suffix not supplied" 858 suffix = "" 859 endif 860 861 String outputPath,tmpName,testStr 862 Variable badLength=0,maxLength=26,l1,l2 863 864 865 tmpName = fname + suffix 866 867 do 868 badLength=0 869 Open/D/M=msg/T="????" refNum as tmpName 870 outputPath = S_fileName 871 872 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename 873 if(strlen(testStr)==0) 874 break //cancel, allow exit 875 endif 876 if(strlen(testStr) > maxLength) 877 badlength = 1 878 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?" 879 if(V_flag==3) 880 outputPath = "" 881 break 882 endif 883 if(V_flag==1) //my suggested name is OK, so trim the output 884 badlength=0 885 l1 = strlen(testStr) //too long length 886 l1 = l1-maxLength //number to trim 887 //Print outputPath 888 l2=strlen(outputPath) 889 outputPath = outputPath[0,l2-1-l1] 890 //Print "modified ",outputPath 891 endif 892 //if(V_flag==2) do nothing, let it go around again 893 endif 894 895 while(badLength) 896 897 return outputPath 898 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WriteQIS.ipf
r472 r474 813 813 End 814 814 815 816 //returns the path to the file, or null if cancel817 Function/S DoOpenFileDialog(msg)818 String msg819 820 Variable refNum821 // String message = "Select a file"822 String outputPath823 824 Open/D/R/T="????"/M=msg refNum825 outputPath = S_fileName826 827 return outputPath828 End829 830 // returns the path to the file, or null if the user cancelled831 // fancy use of optional parameters832 //833 // enforce short file names (26 characters)834 Function/S DoSaveFileDialog(msg,[fname,suffix])835 String msg,fname,suffix836 Variable refNum837 // String message = "Save the file as"838 839 if(ParamIsDefault(fname))840 // Print "fname not supplied"841 fname = ""842 endif843 if(ParamIsDefault(suffix))844 // Print "suffix not supplied"845 suffix = ""846 endif847 848 String outputPath,tmpName,testStr849 Variable badLength=0,maxLength=26,l1,l2850 851 852 tmpName = fname + suffix853 854 do855 badLength=0856 Open/D/M=msg/T="????" refNum as tmpName857 outputPath = S_fileName858 859 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename860 if(strlen(testStr)==0)861 break //cancel, allow exit862 endif863 if(strlen(testStr) > maxLength)864 badlength = 1865 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?"866 if(V_flag==3)867 outputPath = ""868 break869 endif870 if(V_flag==1) //my suggested name is OK, so trim the output871 badlength=0872 l1 = strlen(testStr) //too long length873 l1 = l1-maxLength //number to trim874 //Print outputPath875 l2=strlen(outputPath)876 outputPath = outputPath[0,l2-1-l1]877 //Print "modified ",outputPath878 endif879 //if(V_flag==2) do nothing, let it go around again880 endif881 882 while(badLength)883 884 return outputPath885 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/WriteUSANSData.ipf
r473 r474 53 53 if(dialog) 54 54 PathInfo/S catPathName 55 fullPath = U_DoSaveFileDialog("Save data as")55 fullPath = 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 // returns the path to the file, or null if the user cancelled202 // fancy use of optional parameters203 //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,suffix208 Variable refNum209 // String message = "Save the file as"210 211 if(ParamIsDefault(fname))212 // Print "fname not supplied"213 fname = ""214 endif215 if(ParamIsDefault(suffix))216 // Print "suffix not supplied"217 suffix = ""218 endif219 220 String outputPath,tmpName,testStr221 Variable badLength=0,maxLength=26,l1,l2222 223 224 tmpName = fname + suffix225 226 do227 badLength=0228 Open/D/M=msg/T="????" refNum as tmpName229 outputPath = S_fileName230 231 testStr = ParseFilePath(0, outputPath, ":", 1, 0) //just the filename232 if(strlen(testStr)==0)233 break //cancel, allow exit234 endif235 if(strlen(testStr) > maxLength)236 badlength = 1237 DoAlert 2,"File name is too long. Is\r"+testStr[0,25]+"\rOK?"238 if(V_flag==3)239 outputPath = ""240 break241 endif242 if(V_flag==1) //my suggested name is OK, so trim the output243 badlength=0244 l1 = strlen(testStr) //too long length245 l1 = l1-maxLength //number to trim246 //Print outputPath247 l2=strlen(outputPath)248 outputPath = outputPath[0,l2-1-l1]249 //Print "modified ",outputPath250 endif251 //if(V_flag==2) do nothing, let it go around again252 endif253 254 while(badLength)255 256 return outputPath257 End
Note: See TracChangeset
for help on using the changeset viewer.