//************************************************************* // Sample script provided "as is" by Applied Maths. // You are free to use and modify this script for your // own purposes. // Please notice that improper use of script commands may // corrupt your database. Running this script is entirely at // your own responsibility. Applied Maths accepts no // liability for any damage that results from using // this script. //************************************************************* //$MENU window=main;popup=file;insertafter=Import FAME profiles from Excel;name=Import characters from text file FILE fl; string fileName,fileList,experList,exper,bnFile,delim,delimSt,minVal,maxVal,absent,digits; string linkFieldName,rowList,colList,elist,clist,stateList,dbList; string charName[],fieldName[],entryName[],charFieldName[],col[],row[],char[][],field[][],charField[][],stateVal[]; string key,oldKey,changeKey,experID,st,line,oldField,newField,name; string scriptPath,entryList,charList,charFieldList,fieldList; string entryLinks,charLinks,fieldLinks,charFieldLinks,linkString; string entryAxis,charAxis,nameRowSt,nameColSt; string links,list,field_1,field_2,state,errorlist; integer r,c,i,count,firstLine,fileNr,fileCount,lineLength,button,oldState,found; integer numChars,numEntries,numCharFields,numFields,numCols,numRows,skipRows; integer entryNr,charNr,fieldNr,charFieldNr,stateNr; integer addNewEnt,addNewChar,overWrite,colsAsEntries,absAsZero,conNum,resetAll,bin,open; integer nameRow,nameCol,allEntrs,allChrs,allFlds,allChrFlds; float charVal[],charMax[],charMin[]; CHARSET cs; DIALOG dlg; INDEX charIdx,fieldIdx,linkIdx,entryIdx,charFieldIdx,colIdx,rowIdx,stateIdx; TABLE dataMatrix; XMLNODE nde; lineLength = 10000; scriptPath = "C:\Program Files\BioNumerics\scripts\"; // select file(s) if not(FilePromptName("Please select file(s)",fileList,1)) then stop; while fileList <> "" do { fileName = splitString(fileList," "); bnFile = fileName; bnFile = splitString(bnFile,".txt"); while find(bnFile,"\",1) do splitString(bnFile,"\"); //initialize indexes and counts IdxReset(charIdx);IdxReset(fieldIdx);IdxReset(linkIdx);IdxReset(entryIdx);IdxReset(charFieldIdx); IdxReset(colIdx);IdxReset(rowIdx);IdxReset(stateIdx); numFields = 0; numChars = 0; numEntries = 0; numCharFields = 0; // get defaults if (FileOpenRead(fl,DbGetPath+"\import chars settings.txt")) then { exper = FileRead(fl,100); delimSt = FileRead(fl,100); minVal = FileRead(fl,100); maxVal = FileRead(fl,100); addNewEnt = FileRead(fl,100); addNewChar = FileRead(fl,100); overWrite = val(FileRead(fl,100)); colsAsEntries = val(FileRead(fl,100)); nameRow = val(FileRead(fl,100)); nameCol = val(FileRead(fl,100)); nameRowSt = FileRead(fl,100); nameColSt = FileRead(fl,100); linkFieldName = FileRead(fl,100); absent = FileRead(fl,100); absAsZero = FileRead(fl,100); conNum = val(FileRead(fl,100)); entryLinks = FileRead(fl,100000); charLinks = FileRead(fl,100000); fieldLinks = FileRead(fl,1000); charFieldLinks = FileRead(fl,1000); entryList = FileRead(fl,10000); charList = FileRead(fl,10000); fieldList = FileRead(fl,1000); charFieldList = FileRead(fl,100); stateList = FileRead(fl,1000); FileClose(fl); } else { addNewEnt = 1; addNewChar = 1; nameColSt = "1"; nameRowSt = "1"; nameCol = 1; nameRow = 1; exper = "-Create experiment-"; linkFieldName = "key"; delimSt = "tab"; minVal = "0"; maxVal = "100"; colsAsEntries = 0; overWrite = 0; conNum = 0; } //build settings dialog experList = ""; count = 0; for i = 1 to DbGetExperCount do if DbGetExperClass(i) = "CHR" then experList = experList + DbGetExperName(i) + " "; dbList = ""; for i = 1 to DbGetFieldCount do dbList = dbList + DbGetFieldName(i) + " "; DlgReset(dlg); DlgAddText(dlg,"Experiment:",20,20,60,17); DlgAddList(dlg,experList+"-Create experiment-",exper,88,15,123,200,"DROP"); DlgAddText(dlg,"Save file as:",20,50,60,17); DlgAddEdit(dlg,bnFile,90,50,120,17); DlgAddText(dlg,"Bionumerics field containing unique ID:",20,80,200,17); DlgAddList(dlg,"key "+dbList+"-Create field-",linkFieldName,20,100,190,250,"DROP"); DlgAddText(dlg,"Minimum value:",20,140,90,17); DlgAddEdit(dlg,minVal,120,140,90,17); DlgAddText(dlg,"Maximum value:",20,170,90,17); DlgAddEdit(dlg,maxVal,120,170,90,17); DlgAddText(dlg,"(Range saved for new characters only.)",20,200,200,17); DlgAddText(dlg,"Delimiting character:",20,230,100,17); DlgAddList(dlg,"tab comma space semicolon -other-",delimSt,143,225,73,100,"DROP"); DlgAddText(dlg,"Absent value character:~n(if not blank)",20,260,120,34); DlgAddEdit(dlg,absent,145,260,70,17); DlgAddCheck(dlg,"Flip table (entries = columns)",colsAsEntries,250,20,220,17); DlgAddCheck(dlg,"Row containing names:",nameRow,250,50,150,17); DlgAddEdit(dlg,nameRowSt,400,50,50,17); DlgAddCheck(dlg,"Column containing names:",nameCol,250,80,150,17); DlgAddEdit(dlg,nameColSt,400,80,50,17); DlgAddCheck(dlg,"Add new entries to database",addNewEnt,250,110,200,17); DlgAddCheck(dlg,"Add new characters to database",addNewChar,250,140,200,17); DlgAddCheck(dlg,"Overwrite existing experiments",overWrite,250,170,200,17); DlgAddCheck(dlg,"Convert characters to numbers",conNum,250,200,200,17); if not(DlgShow(dlg,"File '"+bnFile+"'",480,350)) then stop; while val(minVal) >= val(maxVal) do { message("Please select min. and max. values in the correct order"); if not(DlgShow(dlg,"File '"+bnFile+"'",480,330)) then stop; } if delimSt = "tab" then delim = " "; if delimSt = "comma" then delim = ","; if delimSt = "space" then delim = " "; if delimSt = "semicolon" then delim = ";"; if delimSt = "-other-" then { DlgReset(dlg); DlgAddText(dlg,"Delimiter:",20,20,60,17); DlgAddEdit(dlg,delim,85,20,60,17); if not(DlgShow(dlg,"Other delimiter",165,160)) then stop; } if conNum and stateList <> "" then { DlgReset(dlg); DlgAddText(dlg,"Current conversion list:~n(select any to delete)",20,20,200,34); DlgAddList(dlg,stateList,state,20,60,150,100,"MULTI"); if DlgShow(dlg,"Conversion list",200,270) then while state <> "" do { st = splitString(state," "); stateList = splitString(stateList,st+" ") + stateList; } list = stateList; stateNr = 0; while list <> "" do { stateNr = stateNr + 1; IdxSet(stateIdx,splitString(list,"::"),stateNr); stateVal[stateNr] = splitString(list," "); } } if exper = "-Create experiment-" then { exper = ""; DlgReset(dlg); DlgAddText(dlg,"Experiment name:",20,20,100,17); DlgAddEdit(dlg,exper,20,40,150,17); DlgAddCheck(dlg,"Binary values",bin,20,70,150,17); DlgAddCheck(dlg,"Open character set",open,20,100,150,17); DlgAddCheck(dlg,"Absent values are zero",absAsZero,20,130,150,17); DlgAddText(dlg,"Decimal digits:",20,160,150,17); digits = "0"; DlgAddList(dlg,"0 1 2 3 4 5",digits,20,180,100,100,"DROP"); if not(DlgShow(dlg,"Create experiment",200,340)) then stop; DbCreateExperType(exper,"CHR"); st = ""; nde = XMLNodeReadString(st,errorlist); DbSetExperSettings(DbGetExperNr(exper),XMLNodeGetChild(nde,"Charsettings")); XMLNodeCloseDocument(nde); } // create table FileOpenRead(fl,fileName); line = FileRead(fl,lineLength); skipRows = 0; while not(find(line,delim,1)) and not(FileIsEnd(fl)) do { line = FileRead(fl,lineLength); skipRows = skipRows + 1; } if FileIsEnd(fl) then { message("There does not appear to be a delimiter in this file"); stop; } c = 0; st = line; replace(st,delim," "); TableCreate(dataMatrix,"",st); while st <> "" do { splitString(st," "); c = c + 1; } numCols = c; // read file, save in table r = 0; while not(FileIsEnd(fl)) and line <> "" do { r = r + 1; if floor(r/100) = r/100 then setbusy("Reading "+str(r,0,0)+" rows..."); TableAddRow(dataMatrix); for c = 1 to numCols do { st = splitString(line,delim); TableSetField(dataMatrix,r,c,st); } line = FileRead(fl,lineLength); while not(find(line,delim,1)) and not(FileIsEnd(fl)) do line = FileRead(fl,lineLength); } FileClose(fl); numRows = r; setbusy(""); // create initial index of linking field if linkFieldName <> "key" then { if linkFieldName = "-Create field-" then { linkFieldName = ""; DlgReset(dlg); DlgAddText(dlg,"Name of linking field:",20,20,150,17); DlgAddEdit(dlg,linkFieldName,20,40,150,17); while linkFieldName = "" do if not(DlgShow(dlg,"Create linking field",200,200)) then stop; DbAddField(linkFieldName); } resetAll = 0; for i = 1 to DbGetEntryCount do { key = DbGetEntryKey(i); oldField = DbGetField(key,linkFieldName); if oldField <> "" then { if IdxGet(linkIdx,oldField) then { newField = oldField; if not(resetAll) then { DlgReset(dlg); DlgAddText(dlg,"'" + oldField + "' appears more than once~nin '" + linkFieldName + "'.~n~nOK to automatically make ID's ~nunique?",20,20,200,80); resetAll = DlgShow(dlg,"WARNING",200,220); if not(resetAll) then { message("Please link to a field with unique ID's."); stop; } } count = 0; while resetAll and IdxGet(linkIdx,newField) do { count = count + 1; newField = oldField + "/#" + str(count,0,0); } DbSetField(key,linkFieldName,newField); IdxSet(linkIdx,newField,i); } else { DbSetField(key,linkFieldName,oldField); IdxSet(linkIdx,oldField,i); } } } } //create lists of rows and columns rowList = ""; c = val(nameColSt); for r = 1 to numRows do { if nameCol then row[r] = TableGetField(dataMatrix,r,c); else row[r] = "Row " + str(r,0,0); IdxSet(rowIdx,row[r],r); if not(nameRow) or r <> val(nameRowSt)-skiprows then rowList = rowList + row[r] + " "; } colList = ""; r = val(nameRowSt)-skipRows; for c = 1 to numCols do { if nameRow then col[c] = TableGetField(dataMatrix,r,c); else col[c] = "Column "+str(c,0,0); IdxSet(colIdx,col[c],c); if not(nameCol) or c <> val(nameColSt) then colList = colList + col[c] + " "; } // select rows and columns if (colsAsEntries) then { elist = colList; clist = rowList; } else { elist = rowList; clist = colList; } DlgReset(dlg); DlgAddText(dlg,"Entries (shift+click, ctrl+click):",20,20,200,17); DlgAddText(dlg,"Characters (shift+click, ctrl+click):",240,20,200,17); DlgAddText(dlg,"Database fields (shift+click, ctrl+click):",20,280,200,17); DlgAddText(dlg,"Character fields (shift+click, ctrl+click):",240,280,200,17); DlgAddList(dlg,elist,entryList,20,40,200,200,"MULTI"); if ConnDbGetDefault = "" then DlgAddList(dlg,"No connected database","",240,300,200,200,"MULTI"); else DlgAddList(dlg,elist,charFieldList,240,300,200,200,"MULTI"); DlgAddList(dlg,clist,charList,240,40,200,200,"MULTI"); DlgAddList(dlg,clist,fieldList,20,300,200,200,"MULTI"); DlgAddCheck(dlg,"Select All",allEntrs,60,250,70,15); DlgAddButton(dlg,"Link",11,140,240,60,30); DlgAddCheck(dlg,"Select All",allChrs,260,250,70,15); DlgAddButton(dlg,"Link",13,340,240,60,30); DlgAddCheck(dlg,"Select All",allFlds,60,510,70,15); DlgAddButton(dlg,"Link",15,140,500,60,30); DlgAddCheck(dlg,"Select All",allChrFlds,260,510,70,15); DlgAddButton(dlg,"Link",17,340,500,60,30); DlgAddButton(dlg,"Done",18,60,550,140,30); DlgAddButton(dlg,"Cancel",19,260,550,140,30); button = 0; while button < 18 do { if button = 11 then { if allEntrs then entryList = elist; TempStore(linkString,exper+" "+linkFieldName+" "+entryList+" ::"+entryLinks); st = runscript(scriptPath+"_link fields.bns",""); if st <> "cancel" then entryLinks = TempRecall(linkString); } if button = 13 then { if allChrs then charList = clist; TempStore(linkString,exper+" char "+charList+" ::"+charLinks); st = runscript(scriptPath+"_link fields.bns",""); if st <> "cancel" then charLinks = TempRecall(linkString); } if button = 15 then { if allFlds then fieldList = clist; TempStore(linkString,exper+" field "+fieldList+" ::"+fieldLinks); st = runscript(scriptPath+"_link fields.bns",""); if st <> "cancel" then fieldLinks = TempRecall(linkString); } if button = 17 and ConnDbGetDefault <> "" then { if allChrFlds then charFieldList = elist; TempStore(linkString,exper+" charfield "+charFieldList+" ::"+charFieldLinks); st = runscript(scriptPath+"_link fields.bns",""); if st <> "cancel" then charFieldLinks = TempRecall(linkString); } button = DlgShow(dlg,"Select rows and columns",470,630); } if button = 19 then stop; // index and add new entries setbusy("Processing entries..."); if not(allEntrs) then list = entryList; else list = eList; entryList = ""; numEntries = 0; while list <> "" and (allEntrs or numEntries < 999) do { name = splitString(list," "); entryList = entryList + name + " "; if addNewEnt or DbIsKeyPresent(name) or IdxGet(linkIdx,name) then { numEntries = numEntries + 1; IdxSet(entryIdx,name,numEntries); links = entryLinks; while splitString(links,">") <> name and links <> "" do splitString(links," "); if links <> "" then { name = splitString(links," "); invert(name); name = splitString(name,">"); invert(name); } entryName[numEntries] = name; if addNewEnt then { if (find(name,"Row",1) or find(name,"Column",1)) then entryName[numEntries] = DbAddEntry(""); else { if linkFieldName <> "key" and not(IdxGet(linkIdx,entryName[numEntries])) then { key = DbAddEntry(""); DbSetField(key,linkFieldName,entryName[numEntries]); } else if linkFieldName = "key" and not(DbIsKeyPresent(entryName[numEntries])) then DbAddEntry(entryName[numEntries]); } } } } if linkFieldName <> "key" then for i = 1 to DbGetEntryCount do IdxSet(linkIdx,DbGetField(DbGetEntryKey(i),linkFieldName),i); // index and add new characters if not(allChrs) then list = charList; else list = cList; charList = ""; numChars = 0; while list <> "" and (allChrs or numChars < 999) do { if numChars/10 = floor(numChars/10) then setbusy("Processing "+str(numChars,0,0)+" characters..."); name = splitString(list," "); charList = charList + name + " "; if addNewChar or ChrSetFindChar(exper,name) then { numChars = numChars + 1; IdxSet(charIdx,name,numChars); links = charLinks; while splitString(links,">") <> name and links <> "" do splitString(links," "); if links <> "" then { name = splitString(links," "); invert(name); name = splitString(name,">"); invert(name); } charName[numChars] = name; if addNewChar then { if find(name,"Row",1) or find(name,"Column",1) then { i = 1; while ChrSetFindChar(exper,"A" + str(i,0,0)) do i = i + 1; charName[numChars] = "A" + str(i,0,0); } if not(ChrSetFindChar(exper,charName[numChars])) then { ChrSetAddChar(exper,charName[numChars],val(maxVal)); ChrSetRange(exper,ChrSetGetCount(exper),val(minVal),val(maxVal)); } } charMax[numChars] = val(maxVal); charMin[numChars] = val(minVal); } } setbusy(""); // index and add new fields if not(allFlds) then list = fieldList; else list = cList; numFields = 0; while list <> "" do { numFields = numFields + 1; name = splitString(list," "); IdxSet(fieldIdx,name,numFields); links = fieldLinks; while splitString(links,">") <> name and links <> "" do splitString(links," "); if links <> "" then { name = splitString(links," "); invert(name); name = splitString(name,">"); invert(name); } if find(name,"Row",1) or find(name,"Column",1) then { i = 1; while DbGetFieldNr("Field "+str(i,0,0)) do i = i + 1; fieldName[numFields] = "Field "+str(i,0,0); } else fieldName[numFields] = name; if not(DbGetFieldNr(fieldName[numFields])) then DbAddField(fieldName[numFields]); } // index and add new character fields if not(allChrFlds) then list = charFieldList; else list = eList; numCharFields = 0; while list <> "" and ConnDbGetDefault <> "" do { numCharFields = numCharFields + 1; name = splitString(list," "); IdxSet(charFieldIdx,name,numCharFields); links = charFieldLinks; while splitString(links,">") <> name and links <> "" do splitString(links," "); if links <> "" then { name = splitString(links," "); invert(name); name = splitString(name,">"); invert(name); } if find(name,"Row",1) or find(name,"Column",1) then charFieldName[numCharFields] = "Field "+str(numCharFields,0,0); else charFieldName[numCharFields] = name; found = 0; for i = 1 to ChrFldCount(exper) do if ChrFldName(exper,i) = charFieldName[numCharFields] then found = 1; if not(found) then ChrFldAdd(exper,charFieldName[numCharFields]); } // parse selected columns and rows setbusy("Parsing rows and columns..."); for r = 1 to numRows do { for c = 1 to numCols do { if colsAsEntries then { entryNr = IdxGet(entryIdx,col[c]); charNr = IdxGet(charIdx,row[r]); fieldNr = IdxGet(fieldIdx,row[r]); charFieldNr = IdxGet(charFieldIdx,col[c]); } else { entryNr = IdxGet(entryIdx,row[r]); charNr = IdxGet(charIdx,col[c]); fieldNr = IdxGet(fieldIdx,col[c]); charFieldNr = IdxGet(charFieldIdx,row[r]); } if entryNr and fieldNr then field[entryNr][fieldNr] = TableGetField(dataMatrix,r,c); if entryNr and charNr then char[entryNr][charNr] = TableGetField(dataMatrix,r,c); if charNr and charFieldNr then charField[charNr][charFieldNr] = TableGetField(dataMatrix,r,c); } } // add and update entries count = 0; fileNr = 0; resetAll = 0; for i = 1 to DbGetFileCount do if DbGetFileName(i) = bnFile then fileNr = i; fileCount = DbGetFileCount; for entryNr = 1 to numEntries do { setbusy("Saving characters for "+str(entryNr,0,0)+" entries..."); // add new entries if necessary, set index if linkFieldName <> "key" then key = DbGetEntryKey(IdxGet(linkIdx,entryName[entryNr])); else key = entryName[entryNr]; // set database fields for fieldNr = 1 to numFields do if fieldName[fieldNr] <> linkFieldName then DbSetField(key,fieldName[fieldNr],field[entryNr][fieldNr]); // set character values if (overWrite or DbGetEntryLink(key,exper) = "") and numChars > 0 then { if DbGetFileCount > fileCount then { fileNr = 0; for i = 1 to DbGetFileCount do if DbGetFileName(i) = bnFile then fileNr = i; fileCount = DbGetFileCount; } // check if the current file is full, and if so find a file that isn't full if fileNr > 0 then if DbGetFileEntryCount(fileNr) = 300 then fileNr = -1; while fileNr = -1 do { if count > 0 then bnFile = splitstring(bnFile,str(count,3,0)); count = count + 1; bnFile = bnFile + str(count,3,0); fileNr = 0; for i = 1 to DbGetFileCount do if DbGetFileName(i) = bnFile then fileNr = i; if fileNr > 0 then if DbGetFileEntryCount(fileNr) = 300 then fileNr = -1; } if DbGetEntryLink(key,exper) = "" then ChrCreate(cs,exper,bnFile,key); ChrLoad(cs,key,exper); for charNr = 1 to numChars do { i = ChrSetFindChar(exper,charName[charNr]); if (char[entryNr][charNr] <> absent) then { // convert to number if necessary if conNum and val(char[entryNr][charNr]) = 0 then { oldState = IdxGet(stateIdx,char[entryNr][charNr]); if not(oldState) then { stateNr = stateNr + 1; IdxSet(stateIdx,char[entryNr][charNr],stateNr); setbusy(""); DlgReset(dlg); DlgAddText(dlg,"Please enter a numerical value for~n'"+char[entryNr][charNr]+"':",20,20,200,34); DlgAddEdit(dlg,stateVal[stateNr],20,60,100,17); if not(DlgShow(dlg,"New character state",250,160)) then stop; while stateVal[stateNr] = "" do if not(DlgShow(dlg,"New character state",250,160)) then stop; stateList = stateList + char[entryNr][charNr] + "::" + stateVal[stateNr] + " "; oldState = stateNr; } char[entryNr][charNr] = stateVal[oldState]; } ChrSetVal(cs,i,val(char[entryNr][charNr])); // check for range violations if val(char[entryNr][charNr]) > charMax[charNr] then { if not(resetAll) then { setbusy(""); DlgReset(dlg); DlgAddText(dlg,char[entryNr][charNr]+" is greater than "+charName[charNr]+"'s range.",20,20,160,40); DlgAddText(dlg,"OK to automatically reset range?",20,60,200,17); DlgAddCheck(dlg,"Reset all ranges if necessary",resetAll,20,80,200,17); if DlgShow(dlg,"Character outside range",200,220) then { charMax[charNr] = val(char[entryNr][charNr]); ChrSetRange(exper,i,charMin[charNr],charMax[charNr]); } else stop; } else { charMax[charNr] = val(char[entryNr][charNr]); ChrSetRange(exper,i,charMin[charNr],charMax[charNr]); } } if val(char[entryNr][charNr]) < charMin[charNr] then { if not(resetAll) then { setbusy(""); DlgReset(dlg); DlgAddText(dlg,char[entryNr][charNr]+" is less than "+charName[charNr]+"'s range.",20,20,160,40); DlgAddText(dlg,"OK to automatically reset range?",20,60,200,17); DlgAddCheck(dlg,"Reset all ranges if necessary",resetAll,20,80,200,17); if DlgShow(dlg,"Character outside range",200,220) then { charMin[charNr] = val(char[entryNr][charNr]); ChrSetRange(exper,i,charMin[charNr],charMax[charNr]); } else stop; } else { charMin[charNr] = val(char[entryNr][charNr]); ChrSetRange(exper,i,charMin[charNr],charMax[charNr]); } } } else ChrSetAbsent(cs,i); } ChrSave(cs); } } setbusy("Saving database fields..."); DbSaveFields; // save character fields if ConnDbGetDefault <> "" and numChars > 0 then for charNr = 1 to numChars do { for charFieldNr = 1 to numCharFields do ChrFldSet(exper,charName[charNr],charFieldName[charFieldNr],charField[charNr][charFieldNr]); } setbusy(""); //save settings FileOpenWrite(fl,DbGetPath+"\import chars settings.txt"); FileWrite(fl,exper); FileWriteLine(fl); FileWrite(fl,delimSt); FileWriteLine(fl); FileWrite(fl,minVal); FileWriteLine(fl); FileWrite(fl,maxVal); FileWriteLine(fl); FileWrite(fl,str(addNewEnt,0,0)); FileWriteLine(fl); FileWrite(fl,str(addNewChar,0,0)); FileWriteLine(fl); FileWrite(fl,str(overWrite,0,0)); FileWriteLine(fl); FileWrite(fl,str(colsAsEntries,0,0)); FileWriteLine(fl); FileWrite(fl,str(nameRow,0,0)); FileWriteLine(fl); FileWrite(fl,str(nameCol,0,0)); FileWriteLine(fl); FileWrite(fl,nameRowSt); FileWriteLine(fl); FileWrite(fl,nameColSt); FileWriteLine(fl); FileWrite(fl,linkFieldName); FileWriteLine(fl); FileWrite(fl,absent); FileWriteLine(fl); FileWrite(fl,str(absAsZero,0,0)); FileWriteLine(fl); FileWrite(fl,str(conNum,0,0)); FileWriteLine(fl); FileWrite(fl,entryLinks); FileWriteLine(fl); FileWrite(fl,charLinks); FileWriteLine(fl); FileWrite(fl,fieldLinks); FileWriteLine(fl); FileWrite(fl,charFieldLinks); FileWriteLine(fl); FileWrite(fl,entryList); FileWriteLine(fl); FileWrite(fl,charList); FileWriteLine(fl); FileWrite(fl,fieldList); FileWriteLine(fl); FileWrite(fl,charFieldList); FileWriteLine(fl); FileWrite(fl,stateList); FileClose(fl); }