static Function BeforeFileOpenHook(Variable refNum, String fileNameStr, String pathNameStr, String fileTypeStr, String fileCreatorStr, Variable fileKind) if (StringMatch(fileNameStr,"*.itx")) PathInfo $pathNameStr LoadITXwithHeader(S_path+fileNameStr) return 1 endif return 0 End // ------------------- Function LoadITXwithHeader(String filePath) // loads itx with header info int i, refNum = 0 Open /R refNum as filePath // Open the file for reading if (refNum == 0) return -1 // Error opening file endif String currLine = "", comment = "" FReadLine refNum, currLine // "IGOR" line do FReadLine refNum, currLine // keep reading lines if (!StringMatch(currLine,"X //*")) break endif comment += ReplaceString("X //",currLine,"") while(1) Close refNum LoadWave/O/T/Q filePath // load the actual waves String wList = S_waveNames for (i=0; i