4Misc_Start4Platform@ "!ROGIXXp 1<4!*` >winspool\\52zhtv-qs-705\71A Rm A14 RXAP HP LJ 3505IP_134.131.74.82\\52zhtv-qs-705\71A Rm A14 RXAD S odXXLetterPRIV0'''' \ \KhC&=L$ SMTJx HP Universal Printing PSHPDocUISUITrueESPRITSupportedTrueHPOrientationHPOrientationPortraitHPSmartDuplexSinglePageJobTrueHPSmartDuplexOddPageJobTrueHPOrientRotate180FalsePostScriptCustomPageSizeFalseDuplexNoneHPReverseOrderForFold_StitchTrueHPManualDuplexFirstHalfRotateTRUEPaperSizeDefaultForLocaleEuropeanHPBestGlossDefaultInputSlot*UseFormTrayTableHPDuplicateJobNameOverrideSWFWPageSizeLETTERPageRegionLeadingEdgeMediaTypePLAINHPMediaTypeTreeviewPopupTrueCollateFalseJCLHPPrintOnBothSidesManuallyFalseJCLEconomodeFalseOutputBinAutoStapleLocationNonePunchingNoneTextAsBlackFalseAlternateLetterHeadFalseJCLResolution600dpiJCLPrintQualityNoneJCLFastResNoneHPConsumerCustomPaperTruePrintQualityGroupPQGroup_23JRHDInstalledJRHDOffHPNUseDiffFirstPageChoiceTrueHPPageExceptionsFileHPCPE160HPPageExceptionsInterfaceShowPageExceptionsHPPageExceptionsLowEndHPPageExceptionsLowEndVerHPPageExceptionsCoverInsertionHPEnableRAWSpoolingTrueHPDocPropResourceDataHPCabFileNameRGBColorNoCmdCMYKInksNoCmdOutputProfileSHDefaultJRConstraintsJRCHDFullHPColorSmartAutomaticHPColorSmart_ColorOptions_EdgeControlNoCmdHPColorSmart_ColorOptions_HalftoneNoCmdHPColorModeCOLOR_MODEHPColorSmart_Text_NeutralGraysNoCmdHPColorSmart_Text_HalftoneNoCmdHPColorSmart_Text_RGBColorNoCmdHPColorSmart_Graphics_NeutralGraysNoCmdHPColorSmart_Graphics_HalftoneNoCmdHPColorSmart_Graphics_RGBColorNoCmdHPColorSmart_Photo_NeutralGraysNoCmdHPColorSmart_Photo_HalftoneNoCmdHPColorSmart_Photo_RGBColorNoCmdHPPJLEncodingUTF8HPJobAccountingHPJOBACCT_JOBACNT_GROUPNAMEHPBornOnDateHPBODHPJobByJobOverrideJBJOHPJobAccWoPinTruePSAlignmentFileHPCLS160HPSmartHubInet_SID_263_BID_514_HID_265HPColorAsGrayFalseCNOutputNoneCNStapleNoneCNOffsetFalseCNPunchingNoneCNFoldingNoneJCLSHOutputBinNoneJCLSHStapleNoneJCLSHPunchingNoneJCLSHFoldingNoneJCLSHFrontCoverInsertionNoneJCLSHBackCoverInsertionNoneIUPH"xAkAv/z zkhm ъ&TئBCilSIo W#k UD,IP{. ,=OV!p/W{<63>B!Bo5% Byd "!ROGIXXp 1<4!*` >winspool\\52zhtv-qs-705\71A Rm A14 RXAP HP LJ 3505IP_134.131.74.82\\52zhtv-qs-705\71A Rm A14 RXAD S odXXLetterPRIV0'''' \ \KhC&=L$ SMTJx HP Universal Printing PSHPDocUISUITrueESPRITSupportedTrueHPOrientationHPOrientationPortraitHPSmartDuplexSinglePageJobTrueHPSmartDuplexOddPageJobTrueHPOrientRotate180FalsePostScriptCustomPageSizeFalseDuplexNoneHPReverseOrderForFold_StitchTrueHPManualDuplexFirstHalfRotateTRUEPaperSizeDefaultForLocaleEuropeanHPBestGlossDefaultInputSlot*UseFormTrayTableHPDuplicateJobNameOverrideSWFWPageSizeLETTERPageRegionLeadingEdgeMediaTypePLAINHPMediaTypeTreeviewPopupTrueCollateFalseJCLHPPrintOnBothSidesManuallyFalseJCLEconomodeFalseOutputBinAutoStapleLocationNonePunchingNoneTextAsBlackFalseAlternateLetterHeadFalseJCLResolution600dpiJCLPrintQualityNoneJCLFastResNoneHPConsumerCustomPaperTruePrintQualityGroupPQGroup_23JRHDInstalledJRHDOffHPNUseDiffFirstPageChoiceTrueHPPageExceptionsFileHPCPE160HPPageExceptionsInterfaceShowPageExceptionsHPPageExceptionsLowEndHPPageExceptionsLowEndVerHPPageExceptionsCoverInsertionHPEnableRAWSpoolingTrueHPDocPropResourceDataHPCabFileNameRGBColorNoCmdCMYKInksNoCmdOutputProfileSHDefaultJRConstraintsJRCHDFullHPColorSmartAutomaticHPColorSmart_ColorOptions_EdgeControlNoCmdHPColorSmart_ColorOptions_HalftoneNoCmdHPColorModeCOLOR_MODEHPColorSmart_Text_NeutralGraysNoCmdHPColorSmart_Text_HalftoneNoCmdHPColorSmart_Text_RGBColorNoCmdHPColorSmart_Graphics_NeutralGraysNoCmdHPColorSmart_Graphics_HalftoneNoCmdHPColorSmart_Graphics_RGBColorNoCmdHPColorSmart_Photo_NeutralGraysNoCmdHPColorSmart_Photo_HalftoneNoCmdHPColorSmart_Photo_RGBColorNoCmdHPPJLEncodingUTF8HPJobAccountingHPJOBACCT_JOBACNT_GROUPNAMEHPBornOnDateHPBODHPJobByJobOverrideJBJOHPJobAccWoPinTruePSAlignmentFileHPCLS160HPSmartHubInet_SID_263_BID_514_HID_265HPColorAsGrayFalseCNOutputNoneCNStapleNoneCNOffsetFalseCNPunchingNoneCNFoldingNoneJCLSHOutputBinNoneJCLSHStapleNoneJCLSHPunchingNoneJCLSHFoldingNoneJCLSHFrontCoverInsertionNoneJCLSHBackCoverInsertionNoneIUPH"xAkAv/z zkhm ъ&TئBCilSIo W#k UD,IP{. ,=OV!p/W{<63>B!Bo5% Byd "!ROGIXXp 1<4!*` >winspool\\52zhtv-qs-705\71A Rm A14 RXAP HP LJ 3505IP_134.131.74.82\\52zhtv-qs-705\71A Rm A14 RXAD S odXXLetterPRIV0'''' \ \KhC&=L$ SMTJx HP Universal Printing PSHPDocUISUITrueESPRITSupportedTrueHPOrientationHPOrientationPortraitHPSmartDuplexSinglePageJobTrueHPSmartDuplexOddPageJobTrueHPOrientRotate180FalsePostScriptCustomPageSizeFalseDuplexNoneHPReverseOrderForFold_StitchTrueHPManualDuplexFirstHalfRotateTRUEPaperSizeDefaultForLocaleEuropeanHPBestGlossDefaultInputSlot*UseFormTrayTableHPDuplicateJobNameOverrideSWFWPageSizeLETTERPageRegionLeadingEdgeMediaTypePLAINHPMediaTypeTreeviewPopupTrueCollateFalseJCLHPPrintOnBothSidesManuallyFalseJCLEconomodeFalseOutputBinAutoStapleLocationNonePunchingNoneTextAsBlackFalseAlternateLetterHeadFalseJCLResolution600dpiJCLPrintQualityNoneJCLFastResNoneHPConsumerCustomPaperTruePrintQualityGroupPQGroup_23JRHDInstalledJRHDOffHPNUseDiffFirstPageChoiceTrueHPPageExceptionsFileHPCPE160HPPageExceptionsInterfaceShowPageExceptionsHPPageExceptionsLowEndHPPageExceptionsLowEndVerHPPageExceptionsCoverInsertionHPEnableRAWSpoolingTrueHPDocPropResourceDataHPCabFileNameRGBColorNoCmdCMYKInksNoCmdOutputProfileSHDefaultJRConstraintsJRCHDFullHPColorSmartAutomaticHPColorSmart_ColorOptions_EdgeControlNoCmdHPColorSmart_ColorOptions_HalftoneNoCmdHPColorModeCOLOR_MODEHPColorSmart_Text_NeutralGraysNoCmdHPColorSmart_Text_HalftoneNoCmdHPColorSmart_Text_RGBColorNoCmdHPColorSmart_Graphics_NeutralGraysNoCmdHPColorSmart_Graphics_HalftoneNoCmdHPColorSmart_Graphics_RGBColorNoCmdHPColorSmart_Photo_NeutralGraysNoCmdHPColorSmart_Photo_HalftoneNoCmdHPColorSmart_Photo_RGBColorNoCmdHPPJLEncodingUTF8HPJobAccountingHPJOBACCT_JOBACNT_GROUPNAMEHPBornOnDateHPBODHPJobByJobOverrideJBJOHPJobAccWoPinTruePSAlignmentFileHPCLS160HPSmartHubInet_SID_263_BID_514_HID_265HPColorAsGrayFalseCNOutputNoneCNStapleNoneCNOffsetFalseCNPunchingNoneCNFoldingNoneJCLSHOutputBinNoneJCLSHStapleNoneJCLSHPunchingNoneJCLSHFoldingNoneJCLSHFrontCoverInsertionNoneJCLSHBackCoverInsertionNoneIUPH"xAkAv/z zkhm ъ&TئBCilSIo W#k UD,IP{. ,=OV!p/W{<63>B!Bo5% Byd "! ROGIXXp 1<4!*` >winspool\\52zhtv-qs-705\71A Rm A14 RXAP HP LJ 3505IP_134.131.74.82\\52zhtv-qs-705\71A Rm A14 RXAD S odXXLetterPRIV0'''' \ \KhC&=L$ SMTJx HP Universal Printing PSHPDocUISUITrueESPRITSupportedTrueHPOrientationHPOrientationPortraitHPSmartDuplexSinglePageJobTrueHPSmartDuplexOddPageJobTrueHPOrientRotate180FalsePostScriptCustomPageSizeFalseDuplexNoneHPReverseOrderForFold_StitchTrueHPManualDuplexFirstHalfRotateTRUEPaperSizeDefaultForLocaleEuropeanHPBestGlossDefaultInputSlot*UseFormTrayTableHPDuplicateJobNameOverrideSWFWPageSizeLETTERPageRegionLeadingEdgeMediaTypePLAINHPMediaTypeTreeviewPopupTrueCollateFalseJCLHPPrintOnBothSidesManuallyFalseJCLEconomodeFalseOutputBinAutoStapleLocationNonePunchingNoneTextAsBlackFalseAlternateLetterHeadFalseJCLResolution600dpiJCLPrintQualityNoneJCLFastResNoneHPConsumerCustomPaperTruePrintQualityGroupPQGroup_23JRHDInstalledJRHDOffHPNUseDiffFirstPageChoiceTrueHPPageExceptionsFileHPCPE160HPPageExceptionsInterfaceShowPageExceptionsHPPageExceptionsLowEndHPPageExceptionsLowEndVerHPPageExceptionsCoverInsertionHPEnableRAWSpoolingTrueHPDocPropResourceDataHPCabFileNameRGBColorNoCmdCMYKInksNoCmdOutputProfileSHDefaultJRConstraintsJRCHDFullHPColorSmartAutomaticHPColorSmart_ColorOptions_EdgeControlNoCmdHPColorSmart_ColorOptions_HalftoneNoCmdHPColorModeCOLOR_MODEHPColorSmart_Text_NeutralGraysNoCmdHPColorSmart_Text_HalftoneNoCmdHPColorSmart_Text_RGBColorNoCmdHPColorSmart_Graphics_NeutralGraysNoCmdHPColorSmart_Graphics_HalftoneNoCmdHPColorSmart_Graphics_RGBColorNoCmdHPColorSmart_Photo_NeutralGraysNoCmdHPColorSmart_Photo_HalftoneNoCmdHPColorSmart_Photo_RGBColorNoCmdHPPJLEncodingUTF8HPJobAccountingHPJOBACCT_JOBACNT_GROUPNAMEHPBornOnDateHPBODHPJobByJobOverrideJBJOHPJobAccWoPinTruePSAlignmentFileHPCLS160HPSmartHubInet_SID_263_BID_514_HID_265HPColorAsGrayFalseCNOutputNoneCNStapleNoneCNOffsetFalseCNPunchingNoneCNFoldingNoneJCLSHOutputBinNoneJCLSHStapleNoneJCLSHPunchingNoneJCLSHFoldingNoneJCLSHFrontCoverInsertionNoneJCLSHBackCoverInsertionNoneIUPH"xAkAv/z zkhm ъ&TئBCilSIo W#k UD,IP{. ,=OV!p/W{<63>B!Bo5% Byd^Graph*@@??mpWDashSettings#  !0Normal@ Arial<HHHH$$0Normal@ Arial<HHHH$$444444 +QNormal@ Arial<HHHH$$4 4 4 4 4 4 hometld}Y:IR Lab:Lab Code & Software:Igor Procedures:IgorExchange:DataFolderSizeCalc:Y:IR Lab:Lab Code & Software:Igor Procedures:IgorExchange:DataFolderSizeCalc,wt -DVw%ȧ-TVwȧ-u^wt/^w5.1) ObjList = ListObjectsRecursive(DF, 1, "*") elseif (RecurseOption==1) String savDF = GetDataFolder(1) SetDataFolder DF String SubDFlist = DataFolderDir(1) SubDFlist = StringByKey("FOLDERS",DataFolderDir(1),":",";\r") SubDFlist = ReplaceString(",",SubDFlist,";") SetDataFolder savDF else ObjList = WaveListDF(DF,"*",";","TEXT:0") endif Variable Bytes=0, i, j String WN if (RecurseOption==1) // give breakdown for each subfolder Variable TotalBytes = 0 // Do top-most directory DF (non-recursive) ObjList = WaveListDF(DF,"*",";","TEXT:0") for (i=0;i0) if (strlen(DF)==0 || cmpstr(DF,":")==0) DF = GetDataFolder(1) endif objList = DataFolderDir(mode,$DF ) endif endif return ObjList End // Gives list of data objects (numeric and text waves, variables, strings, and folders) in the specified data folder. // Unlike the "dir" command, we also provide the file size, creation date, and modification date (for waves), // and one can sort on any of these (for waves). // // DF: the data folder to list. Leave empty for current data folder. // Ordering Option: Order by 0: Name; 1: File Size; 2: Creation Date; 3: Modified Date Function Dir2(DF,OrderingOption) String DF Variable OrderingOption if (strlen(DF)==0) DF = GetDataFolder(1) endif Variable iObjectType String HorizontalLine = "================================================================" for (iObjectType=1;iObjectType<=4;iObjectType+=1) String sObjectType switch(floor(iObjectType)) case 1: if (iObjectType==1) sObjectType = "NUMERIC WAVES" else // 1.5 sObjectType = "TEXT WAVES" endif break case 2: sObjectType = "VARIABLES" break case 3: sObjectType = "STRINGS" break case 4: sObjectType = "FOLDERS" break endswitch String listStr if (iObjectType==1) // numeric wave listStr = WaveListDF(DF,"*",";","TEXT:0") elseif (iObjectType==1.5) // text wave listStr = WaveListDF(DF,"*",";","TEXT:1") else listStr = FolderObjects(DF,iObjectType,0) Variable iLoc = strsearch(listStr,":",0) if (iLoc>=0) listStr = listStr[iLoc+1,strlen(listStr)-1] listStr = ReplaceString(",",listStr,";") endif endif List2StringWave(listStr,";",Mode=0) WAVE/T W_ListElements Variable i,N=numpnts(W_ListElements) if (floor(iObjectType)==1) // numeric and text waves String FirstTab = PadString("", 5,9) // tabs print "\r"+HorizontalLine+"\r"+sObjectType+FirstTab+"File Size\t\tCreation Date\t\tModified Date\r"+HorizontalLine+"\r" if (iObjectType==1) // numeric waves Make/O/N=(numpnts(W_ListElements)) W_NumWaveFileSizes Make/T/O/N=(numpnts(W_ListElements)) W_NumWaveNames endif Redimension/N=(N,5) W_ListElements // wave name, file size, creation date, modified date for (i=0;i0) DoWindow/K $GN endif Display/N=$GN FileSizes DoWindow/T $GN,"WaveFileSizes: "+DFname+ DFsourceFolder else GN = "WaveFileSizes" if (strlen(WinList(GN,";","WIN:1"))==0) Display/N=$GN FileSizes DoWindow/T $GN,"WaveFileSizes" else ReplaceWave/W=$GN trace=W_NumWaveFileSizes, $(DF+"W_NumWaveFileSizes") DoWindow/F $GN endif endif ModifyGraph/W=$GN mode=5,hbFill=2, log(left)=1, fStyle=1 Label/W=$GN left "Bytes" Label/W=$GN bottom "Wave Name Index of W_NumWaveNames" Cursor/A=1/P/W=$GN A W_NumWaveFileSizes 0 TextBox/W=$GN/C/N=title/F=0/M/B=1/A=MT/X=0.00/Y=0.00 "\\f01\\Z12\\[0Wave File Sizes" TextBox/W=$GN/C/N=text0/F=0/M/B=1/X=0.00/Y=0.00/LS=3 "\\JR\\f02Current Wave:\\f00\r\\{"+DummyStrPath+"+"+DF+"W_NumWaveNames[pcsr(A,\""+GN+"\")]}\r\\{HumanReadableBytes("+DF+"W_NumWaveFileSizes[pcsr(A,\""+GN+"\")])}" SetWindow $GN, hook(cursormoved)=PlotWaveFileSizes_Hook DoUpdate/W=$GN End Function PlotWaveFileSizes_Hook(s) STRUCT WMWinHookStruct &s Variable hookResult = 0 // 0 if we do not handle event, 1 if we handle it. String/G root:Utilities:DataFolderSize:S_DummyStr = "" // need to update, for dynamic text to get updated! DoUpdate/W=$(s.winName) return hookResult // If non-zero, we handled event and Igor will ignore it. End ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // ListObjects - Recursive Routines // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // The following recursive listing functions are written by Jamie Boyd // See Message-Id: 15959, Date: 2007-01-22 // http://wavemetrics.com/search/viewmlid.php?mid=15959 // // These include: ListObjects, ListObjectsRecursive, UpFolders, UpFoldersPopMenuProc // // ****************************************************************************************************** // ListObjects returns a semicolon-separated list of all the objects of the slelected type (objectType) // in the given folder (sourceFoldrStr) whose names match the given string (matchStr) Function/s ListObjects(sourceFolderStr, objectType, matchStr, givepath, erstring) string sourceFolderStr // can be either ":" or "" to specify the current data folder. You can also use a full or partial data folder path. variable objectType // 1 = waves, 2= numeric variables, 3= string variables, 4 = data folders string matchstr // limit list of objects with this wildcard- enhanced string. use "*" to get all objects variable givepath // use 1 to get full or relative filepaths depending on sourceFolderStr. use 0 to get just the objects with no path. string erstring // a string to return if no objects are found string objName ="" // Will contain all the objects in the folder, one by one as we iterate through the index string liststr = "" // will contain the list of objects found and matched variable numObjs // the number of objects in the folder under consideration variable ii // used to iterate through the list of objects if (!(datafolderexists (sourceFolderStr))) return "M1(" + sourceFolderStr + " does not exist." // why the " M1(" ? It is a formatting code for disabling choices in pop-up menus else numObjs = CountObjects(sourceFolderStr, objectType) for (ii = 0; ii < numObjs; ii += 1) objName = GetIndexedObjName(sourceFolderStr, objectType, ii) if (!(stringmatch(objname, matchStr ))) continue endif if (givepath) if ((cmpstr (sourceFolderStr [strlen(sourceFolderStr)-1], ":")) == 0) objName = sourceFolderstr + objname else objName = sourceFolderstr + ":" + objname endif endif liststr += objname + SelectString((objectType == 4), ";", ":;") endfor if ((strlen (liststr)) < 2) liststr = erstring endif return liststr endif end // ****************************************************************************************************** // ListObjectsRecursive(sourceFolderStr, objectType, matchstr) returns a semicolon-separated list of a particular class of objects // in the given folder and all its subfolders. The list is limited to objects whose names contain a particular string of characters. // object names are returned as relative paths from the given folder. Function/s ListObjectsRecursive(sourceFolderStr, objectType, matchstr) string sourceFolderStr // can be either ":" or "" to specify the current data folder. You can use a full or relative datafolder path. variable objectType // 1 = waves, 2= numeric variables, 3= string variables, 4 = data folders string matchstr // limit list of objects with this wildcard- enhanced string. use "*" to get all objects // Do all the objects in this folder string objName ="" // Will contain all the objects in the folder, one by one as we iterate through the index string liststr = "" // will contain the list of objects found and matched variable numObjs // the number of objects in the folder under consideration variable ii // used to iterate through the list of objects if (!(datafolderexists (sourceFolderStr))) return "M1(" + sourceFolderStr + " does not exist." else numObjs = CountObjects(sourceFolderStr, objectType) -1 for (ii = 0; ii <= numObjs; ii += 1) objName = GetIndexedObjName(sourceFolderStr, objectType, ii) if (!(stringmatch(objname, matchStr ))) continue else if ((cmpstr (sourceFolderStr [strlen(sourceFolderStr)-1], ":")) == 0) objName = sourceFolderstr + objName else objName = sourceFolderstr + ":" + objName endif liststr += objName + SelectString((objectType == 4), ";", ":;") endif endfor endif // now we look in all the folders in this folder numObjs = CountObjects(sourceFolderStr, 4) -1 for (ii = 0; ii <= numObjs; ii += 1) if ((cmpstr (sourceFolderStr [strlen(sourceFolderStr)-1], ":")) == 0) objName = (sourcefolderstr + (GetIndexedObjName (sourceFolderStr, 4, ii ))) else objName = (sourcefolderstr + ":" + (GetIndexedObjName (sourceFolderStr, 4, ii ))) endif liststr += ListObjectsRecursive(objname, objectType, matchstr) endfor return liststr end // ****************************************************************************************************** // UpFolders is designed for use as the list expression in a popupmenu for setting the current data folder. // It returns a semicolon-separated list containing the full paths to all the folders in the folder hierarchy // above the current data folder. Because of some fancy formatting, the current folder will be // greyed out (Mac and Windows) and set off by list separators (Mac only) in the popup menu. // Combine with objlist function in the menu expression to get a full hierarchical list of folders, like this: // UpFolders () +(ListObjectsRecursive(":", 4, "*")). Use UpFoldersPopMenuProc to set the current // folder to whatever folder was chosen from the menu. Function/s UpFolders () string backstr = GetDataFolder(1) variable ndepth = ItemsInList(backstr, ":") variable ii, iii string tempstr = ";" for (ii = 0; ii < nDepth -1; ii += 1) for (iii = 0; iii < ii; iii += 1) tempstr += stringfromlist (iii, backstr, ":") + ":" endfor tempstr += stringfromlist (ii, backstr, ":") + ":;" endfor if ((cmpstr ("Macintosh", IgorInfo (2))) == 0) tempstr += "M1-;M1(" + stringfromlist (ii, backstr, ":") + ";M1-;" else tempstr += "M1(" + stringfromlist (ii, backstr, ":") + ";" endif return tempstr end Function UpFoldersPopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl String ctrlName Variable popNum String popStr SetDataFolder popstr end ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // END of ListObjects - Recursive Routines // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////d TXET????3DataFolderProcs.ipfDataFolderProcs_ipfDataFolderProcs.ipf#pragma rtGlobals=1 // Use modern global access method. // Initializes a data folder selector. Function DataFolderPopup_Initialize(ControlName,winNameStr,[InitialPath]) String ControlName,winNameStr,InitialPath if (strlen(ControlNameList(winNameStr,";",ControlName))>0) if (ParamIsDefault(InitialPath)) InitialPath = "root:" endif if (cmpstr(InitialPath[strlen(InitialPath)-1],":")!=0) InitialPath += ":" endif Execute/Q "PopupMenu "+ControlName+",win="+winNameStr+",proc=DataFolderPopup_PopMenuProc,value=DataFolderPopup_MenuList(\""+InitialPath+"\"),mode=1,userdata(CurrentDF)=\""+InitialPath+"\"" endif End // returns DataFolderList for the full data folder path DF, but with DF and ".." pre-pended. // Useful for data folder popup menus (see DataFolderPopup_Initialize() and DataFolderPopup_PopMenuProc()) Function/S DataFolderPopup_MenuList(DF) String DF if (cmpstr(DF[strlen(DF)-1],":")!=0) DF += ":" endif String DFlist = DF+";..;"+ObjectListDF(DF, 4) return DFlist End // Data folder selector! Depends only upon DataFolderPopup_MenuList (which uses ObjectListDF). // // To create a data folder selector, just create a popup menu and run DataFolderPopup_Initialize() // // The currently selected data folder is stored in the popup menu's userdata; it is also the first item in the list. // The second item is ".." which will move up a level. And the remaining items are data folders in the currently // selected data folder; clicking one will make it the currently selected data folder. Function DataFolderPopup_PopMenuProc(pa) : PopupMenuControl STRUCT WMPopupAction &pa switch( pa.eventCode ) case 2: // mouse up Variable popNum = pa.popNum String popStr = pa.popStr String NewDF = popStr String NewDFpath = "" String CurrentDF = GetUserData(pa.win, pa.ctrlName, "CurrentDF" ) if (strlen(CurrentDF)==0) CurrentDF = "root:" endif if (cmpstr(NewDF,CurrentDF)==0) return 0 endif if (cmpstr(NewDF,"..")==0) if (cmpstr(CurrentDF,"root:")!=0) NewDFpath = ParseFilePath(1, CurrentDF, ":", 1, 0) if (cmpstr(NewDFpath[strlen(NewDFpath)-1],":")!=0) NewDFpath+=":" endif Execute/Q "PopupMenu "+pa.ctrlName+",win="+pa.win+", value=DataFolderPopup_MenuList(\""+NewDFpath+"\"),mode=1,userdata(CurrentDF)=\""+NewDFpath+"\"" else Execute/Q "PopupMenu "+pa.ctrlName+",win="+pa.win+",mode=1" // just select the current folder endif else NewDFpath = CurrentDF+NewDF if (cmpstr(NewDFpath[strlen(NewDFpath)-1],":")!=0) NewDFpath+=":" endif Execute/Q "PopupMenu "+pa.ctrlName+",win="+pa.win+", value=DataFolderPopup_MenuList(\""+NewDFpath+"\"),mode=1,userdata(CurrentDF)=\""+NewDFpath+"\"" endif break endswitch return 0 End ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Presents the user with a popup menu from which to choose a data folder. The user clicks OK, // and the selected folder is returned. // The initial path can be specified. If that path does not exist, the default is used. // AllowCancel sets whether the user can cancel out (by clicking "X"); if they do, an empty string is returned. Function/S SelectDataFolder([InitialPath,AllowCancel,AllowNewDF,TitleStr]) String InitialPath Variable AllowCancel, AllowNewDF String TitleStr if (ParamIsDefault(InitialPath)) InitialPath = StrVarOrDefault("root:Utility_Parameters:SelectDataFolder:S_DataFolder","root:") endif if (ParamIsDefault(TitleStr)) TitleStr = "Select Data Folder" endif if (!DataFolderExists(InitialPath) || strlen(InitialPath)==0) InitialPath = "root:" endif if (ParamIsDefault(AllowCancel)) AllowCancel = 0 endif if (ParamIsDefault(AllowNewDF)) AllowNewDF = 0 endif String PanelName = "SelectDataFolder_Panel" PauseUpdate; Silent 1 // building window... DoWindow/K $PanelName NewPanel /W=(150,77,555,141)/N=$PanelName/K=(AllowCancel) as TitleStr PopupMenu popupDataFolder,pos={18,7},size={50,21} DataFolderPopup_Initialize("popupDataFolder",PanelName,InitialPath=InitialPath) Button buttonOK,pos={17,35},size={50,20},proc=SelectDataFolder_ButtonProc,title="OK" if (AllowCancel) // Clicking "X" will also cancel Button buttonCancel,pos={77,35},size={80,20},proc=SelectDataFolder_ButtonProc,title="Cancel" endif if (AllowNewDF) // Clicking "X" will also cancel Button buttonNewDF,pos={197,35},size={100,20},proc=SelectDataFolder_ButtonProc,title="New Folder..." endif NewDataFolder/O root:Utility_Parameters NewDataFolder/O root:Utility_Parameters:SelectDataFolder String/G root:Utility_Parameters:SelectDataFolder:S_DataFolder = "" PauseForUser $PanelName SVAR SelectedDataFolder = root:Utility_Parameters:SelectDataFolder:S_DataFolder return SelectedDataFolder End Function SelectDataFolder_ButtonProc(ba) : ButtonControl STRUCT WMButtonAction &ba switch( ba.eventCode ) case 2: // mouse up // click code here strswitch(ba.ctrlName) case "buttonOK": String DF = GetUserData(ba.win, "popupDataFolder", "CurrentDF" ) String/G root:Utility_Parameters:SelectDataFolder:S_DataFolder = DF DoWindow/K $ba.win break case "buttonCancel": DoWindow/K $ba.win break case "buttonNewDF": DF = GetUserData(ba.win, "popupDataFolder", "CurrentDF" ) String NewDFName = "" Prompt NewDFName, "Name of new data folder:" DoPrompt "New Data Folder",NewDFName Variable NewDFSuccessful = 0 if (strlen(NewDFName)>0) String NewDFPath = DF+PathConcat("",NewDFName) NewDataFolder/O $NewDFPath if (!DataFolderExists(NewDFPath)) DoAlert 0, "The new data folder \""+NewDFName+"\" could not be created. Try again." else NewDFSuccessful = 1 Execute/Q "PopupMenu "+"popupDataFolder"+",win="+ba.win+", value=DataFolderPopup_MenuList(\""+NewDFPath+"\"),mode=1,userdata(CurrentDF)=\""+NewDFPath+":\"" endif endif break endswitch break endswitch return 0 End @4d TXET????3DataFolderSize_Utilities.ipfDataFolderSize_Utilities_ipfDataFolderSize_Utilities.ipf#pragma rtGlobals=1 // Use modern global access method and strict wave access. Function DataFolderSize_Example() SetDataFolder root: make/o/n=5000000 BigWave make/o/n=2000000 MedWave1 make/o/n=1500000 MedWave2 make/o/n=1200000 MedWave3 make/o/n=5000 SmallWave1 make/o/n=1000 SmallWave2 make/o/n=100 SmallWave3 NewDataFolder/O/S root:'DF 1' make/o/n=2000000 MedWave1 make/o/n=1500000 MedWave2 make/o/n=5000 SmallWave1 make/o/n=1000 SmallWave2 NewDataFolder/O/S root:'DF 1':'DF 1a' make/o/n=5000 SmallWave1 make/o/n=1000 SmallWave2 NewDataFolder/O/S root:'DF 2' make/o/b/n=5000000 ByteWave1 make/o/b/n=2000000 ByteWave2 make/o/b/n=5000 ByteWave3 SetDataFolder root: FolderBytes_GUI() End // Same as WaveList, but accepts a specified data folder. // More powerful than ObjectListDF(DF,1), since one can specify the separator string // and an options string (ala WaveList). Function/S WaveListDF(DF,matchStr, separatorStr, optionsStr ) String DF, matchStr, separatorStr, optionsStr if (!DataFolderExists(DF)) return "" endif String savDF = GetDataFolder(1) SetDataFolder DF String output = WaveList(matchStr,separatorStr,optionsStr) SetDataFolder savDF return output End // Simply prints items from a list; easier to read than delimited text (exp. for keyword-value pairs) // Optional parameter ListSep allows for non-semicolon delimiters. Function PrintList(MyList,[ListSep]) String MyList String ListSep if (ParamIsDefault(ListSep)) ListSep = ";" endif Variable i, N=ItemsInList(MyList,ListSep) for (i=0;i testing, but // print "testing" -> print "testing") // // If Mode=0, a faster, simpler method is used which ignores whether delimiters appear within quotes. // // One can process a recreation string (S_recreation) by using alternate quote characters. // e.g., if listSepStr=",", set QuoteChars = "{}" to ignore commas that appear between curly braces. // This function isn't terribly smart (it doesn't differentiate between open and close charcters, for // example) -- with the first time it encounters any quote character, it considers that to be the beginning // of the quotation. The next time, that's the end of the quotation. So use with caution, and only // if you know listStr is well-behaved. Function/S List2StringWave(listStr,listSepStr,[OutputWave,DoStrip,Mode,QuoteChars]) String listStr, listSepStr WAVE/T OutputWave Variable DoStrip, Mode String QuoteChars if (ParamIsDefault(DoStrip)) DoStrip = 1 endif if (ParamIsDefault(Mode)) Mode = 1 endif if (ParamIsDefault(QuoteChars)) QuoteChars = "\"" endif Variable iChar = 0, IsQuoted = 0, iField = -1, i Variable PreviousDelimIndex = 0,CurrentDelimIndex = -1 String outStr = listStr if (Mode==0) // simple -- doesn't pay attention to whether the delimiter lies between quotes // SLOW: //Variable N = ItemsInList(listStr,listSepStr) //Make/T/O/N=(N)/FREE W_ListElements //for (i=0;i=0) W_ListElements[i] = listStr[iLocLast+1,iLoc-1] i+=1 iLocLast = iLoc endif if (i>=N) // only redimension every so often N+=dN Redimension/N=(N) W_ListElements endif While(iLoc>=0) if (iLocLast=0) IsQuoted = !IsQuoted elseif (cmpstr(listStr[iChar],listSepStr)==0) if (!IsQuoted) iField+=1 PreviousDelimIndex = CurrentDelimIndex CurrentDelimIndex = iChar Redimension/N=(iField+1) W_ListElements W_ListElements[iField] = listStr[PreviousDelimIndex+1,CurrentDelimIndex-1] endif endif iChar+=1 While (iChar=0 && IsWhiteSpace) Variable NumTrailingWSchars = strlen(s_out)-(iChar+2) if (Option!=2) // if Option = 2, we'll remove it later... if (iChar+1<0) s_out = "" else s_out = s[0,iChar+1] endif else Variable NumWStoRemove = min(NumLeadingWSchars, NumTrailingWSchars) s_out = s[NumWStoRemove,strlen(s)-1-NumWStoRemove] endif return s_out End // Returns a zero-padded string (used for making wave names) // Value: the value to be returned, padded (will be rounded) // DecimalPlaces: the number of decimal places to use (e.g., for "005", DecimalPlaces = 3) // ForceSign (optional): include "+" if positive ("-" will be included, if negative, regardless) // If Abs(Round(Value)) >= 10^DecimalPlaces, it will just return Round(Value). // [used by Batch_BoverA_and_Beta to return a zero-padded string (used for making wave names)] ThreadSafe Function/S PadTextZeros(Value, DecimalPlaces,[ForceSign]) Variable Value Variable DecimalPlaces Variable ForceSign If (ParamIsDefault(ForceSign)) ForceSign = 0 endif Value = round(Value) Variable i, V_sign = sign(Value) Value = abs(Value) String strValue sprintf strValue,"%0.0f",Value Variable delta = DecimalPlaces - strlen(strValue) if (delta>0) strValue = PadString("",delta,char2num("0")) + strValue endif if (V_sign<0) strValue = "-"+strValue elseif (ForceSign) strValue = "+"+strValue endif return strValue End // subroutine for Sort2DWave Function Sort2DTextWave(WaveToSort,keycol,ReverseSort,OtherWavesList) WAVE/T WaveToSort // 2D Variable keycol // column index; sort on this column Variable ReverseSort String OtherWavesList Duplicate/T/O/FREE/R=[][keycol] WaveToSort, SortWave Redimension/N=(numpnts(SortWave)) SortWave Make/O/FREE/N=(numpnts(SortWave)) SortWave_index Duplicate/T/O/FREE WaveToSort, WaveToSort_Copy if (ReverseSort) MakeIndex/A/R SortWave, SortWave_index else MakeIndex/A SortWave, SortWave_index endif WaveToSort_Copy = WaveToSort[SortWave_index[p]][q] Duplicate/T/O WaveToSort_Copy, WaveToSort // Sort additional waves, if provided Variable i for (i=0;i0 if (ContinueLoop) objList += PossiblyQuoteName(objName)+";" endif i+=1 While (ContinueLoop) objList = SortList(objList) return objList End // Safely concatenates possibly quoted, possibly liberal names // and/or suffixes. // sName is a path or folder, with or without single quotes. // Suffix is something to be tacked on to the last element. // e.g., sName = root:'My Folder':WN_ Suffix = My Suf // --> root:'My Folder':'WN_My Suf' // e.g., sName = root:'My Folder':'W Name Suffix = My Suf // --> root:'My Folder':'W NameMy Suf' // e.g., sName = root:'My Folder':WN Suffix = My Suf // --> root:'My Folder':WNMySuf // e.g., sName = W N Suffix = My Suf // --> 'W NMy Suf' Function/S PathConcat(sName,Suffix) String sName, Suffix if (cmpstr(sName[strlen(sName)-1],":")==0) String Prefix = "" String FullPath = sName else FullPath = ParseFilePath(1, sName, ":", 1, 0) Prefix = ParseFilePath(0, sName, ":", 1, 0) endif if (strlen(Prefix)>0) Prefix = LiberalName_StripQuotes(Prefix) // in case quoted already at beginning or end endif Suffix = LiberalName_StripQuotes(Suffix) print FullPath print Prefix print FullPath+PossiblyQuoteName(Prefix+Suffix) return "" End // Strips any quotes around a liberal name (not recursive) Function/S LiberalName_StripQuotes(sName) String sName if (strlen(sName)==0) return "" endif if (cmpstr(sName[0],"'")==0) sName=sName[1,strlen(sName)-1] endif if (cmpstr(sName[strlen(sName)-1],"'")==0) sName=sName[0,strlen(sName)-2] endif return sName End )dTXET????NotesNotesNotesTo get started, enter DataFolderSize_Example() on the command line. To skip auto-creating example waves, call the FolderBytes_GUI() directly.// Platform=WindowsNT, IGORVersion=6.323, architecture=Intel, systemTextEncoding="Windows-1252", historyTextEncoding="Windows-1252", procwinTextEncoding="Windows-1252" Silent 101 // use | as bitwise or -- not comment. NewPath/Z tmpPath "C:" DefaultFont "Arial" MoveWindow/P 5.25,42.5,504.75,337.25 String/G root:gWMSetNextTextFilesTextEncoding = "Windows-1252" // Text encoding for Notes. Used by Igor Pro 7. OpenNotebook/N=Notes/W=(246,62,586.5,104)/J=82885 "Notes" String/G root:gWMSetNextTextFilesTextEncoding = "Windows-1252" // Text encoding for "DataFolderSize_Utilities.ipf". Used by Igor Pro 7. OpenProc/W=(245.25,131.75,697.5,487.25)/J=69501 "DataFolderSize_Utilities.ipf" String/G root:gWMSetNextTextFilesTextEncoding = "Windows-1252" // Text encoding for "DataFolderProcs.ipf". Used by Igor Pro 7. OpenProc/W=(264.75,155,717.75,512.75)/J=63144 "DataFolderProcs.ipf" String/G root:gWMSetNextTextFilesTextEncoding = "Windows-1252" // Text encoding for "DataFolderSize.ipf". Used by Igor Pro 7. OpenProc/W=(282.75,176.75,734.25,533)/J=38848 "DataFolderSize.ipf" MoveWindow/C 236.25,560,735,678.5 KillStrings/Z root:gWMSetNextTextFilesTextEncoding Q#pragma rtGlobals=3 // Use modern global access method and strict wave access.