DIALOG dlg; string fieldlist,fieldsel,filename,key,st,st1,experlist,expername,seqstr; sequence sq; integer i; FILE fp; fieldlist="Key "; for i=1 to DbGetFieldCount do fieldlist=fieldlist+DbGetFieldName(i)+" "; fieldsel="Key"; for i=1 to DbGetExperCount do if DbGetExperClass(i)="SEQ" then experlist=experlist+DbGetExperName(i)+" "; expername=experlist;expername=splitstring(expername," "); DlgAddText(dlg,"Select the field(s) you want to export",20,20,180,15); DlgAddList(dlg,fieldlist,fieldsel,20,40,180,150,"MULTI"); DlgAddText(dlg,"Select the Sequence Type",220,20,150,15); DlgAddList(dlg,experlist,expername,220,40,150,150,"LIST"); if not(DlgShow(dlg,"Export ?aligned? sequences",490,220)) then stop; filename=DbGetPath+"\export.txt"; if not(FileOpenWrite(fp,filename)) then { message("ERROR: unable to create export file"); stop; } for i=1 to DbGetEntryCount do if DbGetSel(DbGetEntryKey(i)) then { key=DbGetEntryKey(i); st=fieldsel; filewrite(fp,">"); while st<>"" do { st1=splitstring(st," "); if st1="key" then FileWrite(fp,key+"|"); if st1<>"key" then FileWrite(fp,DbGetField(key,st1)+"|"); } FileWriteLine(fp); seqload(sq,key,expername);Seqget(sq,seqstr); FileWrite(fp,seqstr); FileWriteLine(fp);FileWriteLine(fp); } FileClose(fp); execute("notepad.exe "+filename);