// -*- ASCII:EDT -*- // bibFindEntry54.edt // part of the bibMacros package // (schlicht 20011219) // $Revision: 1.1 $ ///////////////////////// // Read the global configuration file, if it exists: IfFileExists("%b\Macros\LaTeX\bibMacros.cfg",> !"Exe('%b\Macros\LaTeX\bibMacros.cfg');",> !"IfFileExists('%B\Macros\LaTeX\bibMacros.cfg',> !'Exe(''%B\Macros\LaTeX\bibMacros.cfg'');',> !'Assign(''bib_beginLine'',''<'');> Assign(''Borb'',> !*IfFileExists(''%b\%$(|BorbFile|);'',> !''Assign(""%$(|BorbName|);"",""%b\%$(|BorbFile|);"");'',> !''IfFileExists(""%B\%$(|BorbFile|);"",> !""Assign(''''%$(|BorbName|);'''',''''%B\%$(|BorbFile|);'''');"",> !""Assign(''''%$(|BorbName|);'''',''''???'''');"");'');> Release(''BorbName'');> Release(''BorbFile'');> *);'> );"> ); Assign("BorbName","BM_bibFindEntry.edt"); Assign("BorbFile","Macros\LaTeX\bibFindEntry.edt"); Do("%$('Borb');"); // Get the bibliography: IfisMode("BibTeX","%!m",> !`// we either are in a BibTeX file: <> GetBuild(0);> IfNum("%!0","20020802",">",> !"GetDocAsASCII(0,'%p\%n%t',0,0);",> !"SetSel(0);> GetSel(1,0);");> Assign('BM_file','%p\%n%t');`,> !`// or we'll get it from the .aux file (to be on the safe side) <> Assign("BM_file","%P\%N");> IfFileExists("%$('BM_file');.aux",> !"ReadFile('%$(|BM_file|);.aux',0);",> !"Prompt('I need the file%\ ""%$(|BM_file|);.aux"".%\%\Run LaTeX on your main file, and then we can try again.',3,1); Exit;");> FindInString("%!0","\\bibdata\{*\}",1,2,11);> IfOK(!"ExtractByIndex(1,'%!0',%!1+9,%!2-1);",> "Prompt('I found no \bibliography command%\in %$(|BM_file|);.tex.',3,1); Exit;");> LetReg(0,"");> LetRegNum(3,-1);> LetRegNum(4,-1);> Loop(!:> FindInString("%!1","{~,}*,",2,3,1011,%!3+1);> IfOK(> !"ExtractByIndex(6,'%!1',%!2,%!3-1);",> !"ExtractByIndex(6,'%!1',%!4+1,%!3+1);> Stop;"> );> IfFileExists("%b\Macros\LaTeX\bibGetFile.edt","> Exe('%b\Macros\LaTeX\bibGetFile.edt');","> IfFileExists('%B\Macros\LaTeX\bibGetFile.edt',> 'Exe(''%B\Macros\LaTeX\bibGetFile.edt'');',> 'Assign(''BM_getFile'',''noBM'');');");> IfStr("%$('BM_getFile');","cancel","=","Exit;");> IfStr("%$('BM_getFile');","noBM","=",> !"IfStr('%$(|BM_%$(*BM_file*);_%!6|);','','=',!'Assign(''BM_%$(|BM_file|);_%!6'',''%P'');');> IfFileExists('%$(|BM_%$(*BM_file*);_%!6|);\%!6.bib',> !'ReadFile(''%$(|BM_%$(*BM_file*);_%!6|);\%!6.bib'',4);',> !'Prompt(''I don''''t know where the file%\ ""%!6.bib"" is!%\%\Can you help me, please?%\(If you were using the complete bibMacros package%\I would probably be able to find the file.)'',2,3,> !''Browse(4,|Looking for ""%!6.bib""||*.bib|,|%P|);> GetFilePath(|%!4|,2);> Assign(|BM_%$(*BM_file*);_%!6|,|%!2|);> ReadFile(|%!4|,4);'',> ''Exit;''> );'> );"> );> LetReg(0,'%!0%\%!4');> LetRegNum(4,%!3);> :);> `); // Get Search String Assign("BorbName","BM_MUI");> Assign("BorbFile","Plugins\MUI\mui.exe");> IfFileExists("%['%$(|Borb|);'];%$('BM_MUI');",!`> IfStr("%$('bib_bibStyle');","","=","",!"> Assign('BorbName','BM_Fields_%$(|bib_bibStyle|);.cfg');> Assign('BorbFile','Macros\LaTeX\bibMacrosFields_%$(|bib_bibStyle|);.cfg');> IfStr('%[|%$(:Borb:);|];%$(|BM_Fields_%$(*bib_bibStyle*);.cfg|);','???','<>',> 'Exe(''%$(|BM_Fields_%$(*bib_bibStyle*);.cfg|);'');');"> );> Assign("BorbName","BM_Fields.cfg");> Assign("BorbFile","Macros\LaTeX\bibMacrosFields.cfg");> IfStr("%['%$(|Borb|);'];%$('BM_Fields.cfg');","???","=",> !"Assign('bib_ENTRIES',!'{ARTICLE}{BOOK}{BOOKLET}{INBOOK}{INCOLLECTION}{INPROCEEDINGS}> {CONFERENCE}{MANUAL}{MASTERSTHESIS}{PHDTHESIS}{MISC}{PROCEEDINGS}{TECHREPORT}{UNPUBLISHED}');",> !"Exe('%$(|BM_Fields.cfg|);');");> IfStr("%$('bib_ENTRIES%$(|bib_bibStyle|);');","","=","Release('bib_bibStyle');");> // write the MUI file: OpenOutput("%b\Macros\LaTeX\bibFind.mui");> IfStr("%$('BM_findBoth');","","=","Assign('BM_findBoth','1');");> IfStr("%$('BM_findEntryWhole');","","=","Assign('BM_findEntryWhole','1');");> IfStr("%$('BM_findEntryCS');","","=","Assign('BM_findEntryCS','0');");> IfStr("%$('BM_findEntryRE');","","=","Assign('BM_findEntryRE','0');");> WrL("MUITitle(""Find bibliography entry"");");> WrL("MUIWidth(300);");> WrL('MUILabel("Search for ...");');> WrL('MUIEditBox("");'); // Edit1 <> WrL('MUIRadioButton("...and...|...or...",%$(|BM_findBoth|);,"");'); // Radio1 <> WrL('MUIEditBox("");'); // Edit2 <> WrL('MUILabel(" ");');> LetReg(4,"MUILabelComboBox(""only in ..."","""); // Combo1 <> LetRegNum(2,0);> Loop(!"> SetOK(1);> FindInString('%$(|bib_ENTRIES%$(*bib_bibStyle*);|);','\{\(*\)\}',1,2,1001,%!2);> IfOK(!'GetTag(0,1);> LetReg(4,""%!4|%!1"");',> 'Stop;');> ");> WrL("%!4"",1);");> WrL("MUILabel(' ');");> WrL("MUICheckBox('Whole words only',%$(|BM_findEntryWhole|););");// CheckBox1 <> WrL("MUICheckBox('Case-sensitive',%$(|BM_findEntryCS|););"); // CheckBox2 <> WrL("MUICheckBox('Regular expression',%$(|BM_findEntryRE|););"); // CheckBox3 <> WrL("MUILabel(' ');");> // previous results: LetRegNum(2,0);> LetReg(9,"");> Loop(!"> SetOK(1);> FindInString('%$(|BM_findEntry_%$(*BM_file*);|);','<{~>}*>',1,2,1001,%!2);> IfOK(!'> ExtractByIndex(1,''%$(|BM_findEntry_%$(*BM_file*);|);'',%!1,%!2-2);> SetOK(1);> FindInString(''%!1'',''_\(0+^_\)_\(1+^_\)_\(2+^_\)_\(3+^_\)_\(4*\)_'',3,4,101);> // search string GetTag(0,7);> LetRegNum(4,-1);> Loop(!''SetOK(1);> FindInString(""%!7"",""|"",3,4,1000,%!4+2);> IfOK(!""ReplaceInString(|%!7|,|\|||,%!3,%!4,0,7);"",""Stop;"");''> );> // entry type? GetTag(4,5);> IfStr(|%!5|,||,|<>|,> !|LetReg(7,||''%!7'' (%!5)||);|,> !|LetReg(7,||''%!7''||);|);> // whole word? GetTag(1,5);> IfStr(|%!5|,|1|,|=|,> !|LetReg(7,||%!7 /w||);|);> // case sensitive? GetTag(2,5);> IfStr(|%!5|,|1|,|=|,> !|LetReg(7,||%!7 /c||);|);> // regular expression? GetTag(3,5);> IfStr(|%!5|,|1|,|=|,> !|LetReg(7,||%!7 /r||);|);> // results? IfStr(|%$(*%!1*);|,|NONE|,|=|,> !|LetReg(7,||%!7 [NONE]||);|);> LetReg(9,''%!9|%!7'');','Stop;'> );"> );> IfStr("%!9","","<>",!"> WrL('MUILabel('' '');');> WrL('MUIComboBox(""Previous Queries...%!9"",1);'); // Combo2 <> WrL('MUICheckBox(''Search again...'');'); // CheckBox4 <> WrL('MUILabel('' '');');> ");> LetRegNum(9,1);> IfStr("%$('BM_findEntryInsert');","Entry","=","LetRegNum(9,2);");> // IfStr("%$('BM_findEntryInsert');","GoTo","=","LetRegNum(9,3);");> // WrL("MUIRadioButton('Insert KEY|Insert Entry|Go To Entry',%!9,'Action...');"); // RadioButton2 <> WrL("MUIRadioButton('Insert KEY|Insert Entry',%!9,'Action...');"); // RadioButton2 <> // WrL("MUICheckBox('Insert all keys/entries');"); // CheckBox5 <> CloseOutput;> LetReg(8,"");> LetReg(9,"");> Release("MUIEditBox1");> Release("MUIEditBox2");> Release("MUIComboBox1");> Assign("MUIComboBox2","Previous Queries...");> Release("MUIRadioButton1");> Release("MUIRadioButton2");> Release("MUICheckBox1");> Release("MUICheckBox2");> Release("MUICheckBox3");> Release("MUICheckBox4");> WinExe("","%$('BM_MUI'); ""%b\Macros\LaTeX\bibFind.mui""","","",000100);> SetFocus("");> DeleteFile("%b\Macros\LaTeX\bibFind.mui");> IfStr("%$('MUIOK');","1","=","","Exit;");> // search string 1 IfStr("%$('MUIEditBox1');","","=",> !"IfStr('%$(|MUIEditBox2|);','','=','',!'LetReg(8,''%$(|MUIEditBox2|);'');Release(''MUIEditBox2'');');",> !"LetReg(8,'%$(|MUIEditBox1|);')");> // search string 2 IfStr("%$('MUIEditBox2');","","=","",> !"LetReg(9,'%$(|MUIEditBox2|);');");> // regular expression? IfStr("%$('MUICheckBox3');","1","=",> "Assign('BM_findEntryRE','1');",> "Assign('BM_findEntryRE','0');");> // ... then escape special characters IfStr("%$('BM_findEntryRE');","0","=",> !"LetRegNum(7,8);> Repeat(2,!'> LetRegNum(3,-2);> Loop(''> SetOK(1);> FindInString(|%%!%!7|,|[\\?*+@$\[\]{}||~^<>.]|,2,3,1001,%%!3+2);> IfOK(!|InsertByIndex(%!7,""%%!%!7"",""\"",%%!3);|,> |Stop;|);> '');> LetRegNum(7,9);> ');");> // & or |? IfStr("%$('MUIRadioButton1');","...and...","=",> "Assign('BM_findBoth','1');",> "Assign('BM_findBoth','2');");> IfStr("%!9","","=",> !"LetReg(9,'%!8');",> !"IfStr('%$(|BM_findBoth|);','2','=',> !'LetReg(9,''%!8|%!9'');',> !'LetReg(9,''%!8&%!9'');');");> // types IfStr("%$('MUIComboBox1');","","=",> !"Release('BM_findEntryType');",> !"Assign('BM_findEntryType','%$(|MUIComboBox1|);');");> // whole words? IfStr("%$('MUICheckBox1');","1","=",> "Assign('BM_findEntryWhole','1');",> "Assign('BM_findEntryWhole','0');");> // case sensitive? IfStr("%$('MUICheckBox2');","1","=",> "Assign('BM_findEntryCS','1');",> "Assign('BM_findEntryCS','0');");> // previous queries IfStr("%$('MUIComboBox2');","Previous Queries...","<>",> !"SetOK(1);> FindInString('%$(|MUIComboBox2|);','''*''',3,4,1);> IfOK(!'ExtractByIndex(9,""%$(|MUIComboBox2|);"",%!3+1,%!4-1);');> SetOK(1);> FindInString('%$(|MUIComboBox2|);','(*)',3,4,1);> IfOK(!'> ExtractByIndex(1,""%$(|MUIComboBox2|);"",%!3+1,%!4-1);> Assign(|BM_findEntryType|,|%!1|);');> SetOK(1);> FindInString('%$(|MUIComboBox2|);','/w',3,4);> IfOK(!'Assign(|BM_findEntryWhole|,|1|);','Assign(|BM_findEntryWhole|,|0|);');> SetOK(1);> FindInString('%$(|MUIComboBox2|);','/c',3,4);> IfOK(!'Assign(|BM_findEntryCS|,|1|);','Assign(|BM_findEntryCS|,|0|);');> SetOK(1);> FindInString('%$(|MUIComboBox2|);','/r',3,4);> IfOK(!'Assign(|BM_findEntryRE|,|1|);','Assign(|BM_findEntryRE|,|0|);');> ");> // allow empty search strings if Type isn't empty IfStr("%!9","","=",> !"IfStr('%$(|BM_findEntryType|);','','<>','LetReg(9,'' '');');");> // new search? IfStr("%$('MUICheckBox4');","1","=","LetReg(9,'reset!%!9');");> Assign("BM_findEntryInsert","Key");> // Action IfStr("%$('MUIRadioButton2');","Insert Entry","=",> !"Assign('BM_findEntryInsert','Entry');");> IfStr("%$('MUIRadioButton2');","Go To Entry","=",> !"Assign('BM_findEntryInsert','GoTo');");> `,!`> // no MUI plug-in available: LetReg(9,"%$('BM_findEntryString');");> EnterReg(9,"Enter Search String ( ""|"" = OR ; ""&&"" = AND ) :","Find Entry");> Assign("BM_findEntryWhole","1");> Assign("BM_findEntryCS","0");> Release("BM_findEntryType");> `); IfStr("%!9","","=","Prompt('You cannot search for empty strings!',3,0);Exe('%$(|BM_bibFindEntry.edt|);');Exit;"); // RESET all search results: IfStr("%!9","reset!","=",!`> Prompt("Forget all search results?",1,3,"","Exit;");> LetRegNum(2,0);> Loop(!"> SetOK(1);> FindInString('%$(|BM_findEntry_%$(*BM_file*);|);','<{~>}*>',1,2,1011,%!2);> IfOK(!'> ExtractByIndex(1,''%$(|BM_findEntry_%$(*BM_file*);|);'',%!1,%!2-2);> Release(''%!1'');',> 'Stop;'> );> ");> Release('BM_findEntry_%$(*BM_file*);');> LetReg(9,'');> Exe('%$(|BM_bibFindEntry.edt|);');> Exit;> `); // RESET the current search result: SetOK(1); FindInString("%!9"," ReplaceInString('%!9','',%!1,%!2,0,9);> SetOK(1);> FindInString('%$(|BM_findEntry_%$(*BM_file*);|);','BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_',1,2,10);> IfOK(!'> ReplaceInString(''%$(|BM_findEntry_%$(*BM_file*);|);'','''',%!1,%!2+2,0,1);> Assign(''BM_findEntry_%$(|BM_file|);'',''%!1'');'> );> Release('BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_');> "); // SHOW previous search results (only if not using MUI) IfStr("%!9","show!","=",!`> Interface("Previous Queries");> LetRegNum(2,0);> Loop(!"> SetOK(1);> FindInString('%$(|BM_findEntry_%$(*BM_file*);|);','<{~>}*>',1,2,1011,%!2);> IfOK(!'> ExtractByIndex(1,''%$(|BM_findEntry_%$(*BM_file*);|);'',%!1,%!2-2);> SetOK(1);> FindInString(''%!1'',''_\(0+^_\)_+^__+^__+^__*_'',3,4,101);> // search string GetTag(0,7);> LetRegNum(4,-1);> Loop(!''SetOK(1);> FindInString(""%!7"",""|"",3,4,1000,%!4+2);> IfOK(!""ReplaceInString(|%!7|,|\|||,%!3,%!4,0,7);"",""Stop;"");''> );> // results? IfStr(|%$(*%!1*);|,|NONE|,|=|,> !|LetReg(7,||%!7 [NONE]||);|);> Item(''%!7'',''LetReg(9,|%!7|);'');','Stop;'> );"> );> LetReg(9,"");> IfStr("%$('BM_findEntry_%$(|BM_file|);');","","=",> "Prompt('No previous search results!',2,0);> Exe('%$(|BM_bibFindEntry.edt|);');> Exit;",> !"ShowList(0,1,!'Do(''%?'');','Exit;');> IfStr('%!9','','=','Exit;');");> `); Assign("BM_findEntryString","%!9"); Interface("%$('BM_findEntryType'); Entries containing ""%$('BM_findEntryString');"""); // Already searched for this one? IfStr("%$('BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_');","","=",> !`Assign("BM_findEntry_%$(|BM_file|);",> "BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_%\%$('BM_findEntry_%$(|BM_file|);');");`,> !`SetOK(1);> FindInString('%$(|BM_findEntry_%$(*BM_file*);|);','BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_%\',1,2,10);> IfOK(!'> ReplaceInString(''%$(|BM_findEntry_%$(*BM_file*);|);'','''',%!1,%!2,0,1);> Assign(''BM_findEntry_%$(|BM_file|);'',''BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_%\%!1'');'> );> IfStr("%$('BM_findEntry_%$(|BM_file|);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(|BM_findEntryRE|);_%$(|BM_findEntryType|);_');","NONE","=",!"> LetRegNum(2,-1);> // Windows thinks, `&x' means `\underline{x}', therefore we have to double the ampersand: Loop(!'SetOK(1);> FindInString(''%!9'',''&'',1,2,1000,%!2+2);> IfOK(!''ReplaceInString(|%!9|,|&&|,%!1,%!2,0,9);'',''Stop;'');'> );> Prompt('No %$(|BM_findEntryType|); entries matching string%\ ''%!9''');> Exit;"> );> StartWorking("Entries containing ""%!9"" ...");> LetRegNum(2,0);> Loop(!"> SetOK(1);> FindInString('%$(|BM_findEntry_%$(*BM_file*);_%!9_%$(*BM_findEntryWhole*);_%$(*BM_findEntryCS*);_%$(*BM_findEntryRE*);_%$(*BM_findEntryType*);_|);','<{~>}*>',1,2,1011,%!2);> IfOK(!'> ExtractByIndex(1,''%$(|BM_findEntry_%$(*BM_file*);_%!9_%$(*BM_findEntryWhole*);_%$(*BM_findEntryCS*);_%$(*BM_findEntryRE*);_%$(*BM_findEntryType*);_|);'',%!1,%!2-2);> Do(''%!1'');',> 'Stop;'> );"> );> StopWorking;> BeginGroup;> ShowList(0,1,!'Do(''%?'');');> EndGroup;> Exit;> `); // Prepare search string LetRegNum(2,-1); LetRegNum(7,0); Loop(!`> SetOK(1);> FindInString("%!9&","{~&}*&",1,2,1011,%!2+1);> IfOK(!"> ExtractByIndex(4,'%!9',%!1,%!2-1);> IfStr('%$(|BM_findEntryWhole|);','1','=',> !'Assign(''BM_findEntryString%!7'',''$~Alpha${%!4}$~Alpha$'');',> !'Assign(''BM_findEntryString%!7'',''%!4'');');> LetRegNum(7,%!7+1);> ","Stop;");> `); // Find entries: LetRegNum(2,0); StartWorking("Search for ""%$('BM_findEntryString0');""...");> GetLength(8,"%!0"); Loop(!`> Release("working");> Repeat("76-((%!2*75)/%!8)",!"Assign('working','%$(|working|);|');");> StartWorking("%$('working');");> // Jump to the next entry: SetOK(1);> FindInString("%!0","%$('bib_beginLine');\@%$('BM_findEntryType');",1,2,1011,%!2);> IfOK("","Stop;");> FindInString("%!0","%$('BM_findEntryString0');",1,2,1001,%!2);> IfOK(!"> SetOK(1);//((((<> FindInString('%!0','%$(|bib_beginLine|);\@+{$Alpha$}@{ }{\{@{>|{\{@{>|{\{@{>|{\{@{>|{\{*\}}|^{\}}}\}}|^{\}}}\}}|^{\}}}\}}|^{\}}}\}}|{(@{>|{(@{>|{(@{>|{(@{>|{(*)}|^{)}})}|^{)}})}|^{)}})}|^{)}})}',1,3,1101,%!2);> ExtractByIndex(6,'%!0',%!1,%!3);> LetReg(1,'%!6');> // correct entry type? IfStr('%$(|BM_findEntryType|);','','<>',!'> FindInString(''%!1'',''\@*{\{|(}'',3,4,1);> ExtractByIndex(3,''%!1'',%!3+1,%!4-1);> FormatString(''%!3'',3,''trimboth'');> IfIStr(''%!3'',''%$(|BM_findEntryType|);'',''<>'',''LetReg(1,||);'');> ');> // find additional search strings LetRegNum(5,0);> Repeat(%!7,!'> SetOK(1);> FindInString(''%!1'',''%$(|BM_findEntryString%!5|);'',3,4,''%$(|BM_findEntryCS|);1'');> IfOK('''',''LetReg(1,||);'');> LetRegNum(5,%!5+1);> ');> IfStr('%!1','','=','',!'> SetOK(1);> FindInString(''%!1'',''{\{|(}+^{,}'',4,5,11);//)<> ExtractByIndex(3,''%!1'',%!4+1,%!5);> ReplaceInString(''%!1'','''',0,%!5+1,0,1);> // this would not remove the TYPE in the results list: // ReplaceInString(''%!1'','' '',%!4+1,%!5+1,0,1);> Loop(!''> SetOK(1);> FindInString(""%!3"","">"",4,5,1);> IfOK(!""> ReplaceInString(|%!3|,||,%!4,%!5,0,3);"",> ""Stop;"");''> );> FormatString(''%!3'',3,''trimboth'');> // compress the entry: FormatString(''%!1'',1,''trimboth'');> GetLength(5,''%!1'');> IfNum(%!5,500,''>'',!''ExtractByIndex(1,|%!1|,0,500);'');> LetRegNum(5,-1);> Loop(!''> SetOK(1);> FindInString(|%!1|,|{@{ }>}||{ +{ }}|,4,5,1011,%!5);> IfOK(!|> ReplaceInString(||%!1||,|| ||,%!4,%!5,0,1);> LetRegNum(5,||%!5-(%!5-%!4)||);|,> |Stop;|> );''> );> Assign(|%!3|,|%!6|);> Item(|[%!3] : %!1|,|IfStr(''%%$(*BM_findEntryInsert*);'',''Entry'',''='',!''Do(*Ins(||%%$(**%!3**);||);*);'',!''Ins(||%!3||);'');|);> // // Insert list: // IfStr(|%$(*BM_findEntryInsert*);|,|List|,|=|,!|LetReg()) // Store search result for next time: LetRegNum(5,-1);> // double `|'s: Loop(!''SetOK(1);> FindInString(""%!1"",""|"",4,5,1000,%!5+2);> IfOK(!""ReplaceInString(|%!1|,||||||,%!4,%!5,0,1);"",""Stop;"");''> );> Assign(''BM_findEntry_%$(*BM_file*);_%!9_%$(*BM_findEntryWhole*);_%$(*BM_findEntryCS*);_%$(*BM_findEntryRE*);_%$(*BM_findEntryType*);_'',> ''%$(|BM_findEntry_%$(*BM_file*);_%!9_%$(*BM_findEntryWhole*);_%$(*BM_findEntryCS*);_%$(*BM_findEntryRE*);_%$(*BM_findEntryType*);_|);Item(|[%!3] : %!1|,> !|IfStr(""%%$(*BM_findEntryInsert*);"",""Entry"",""="",!""Do(*Ins(||%%$(**%!3**);||);*);"",!""Ins(||%!3||);"");|);%\'');'> );",> "Stop;"> );> `); StopWorking; // Show the list: IfStr("%$('BM_findEntry_%$(*BM_file*);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(*BM_findEntryRE*);_%$(*BM_findEntryType*);_');","","=",> !"Assign('BM_findEntry_%$(*BM_file*);_%!9_%$(|BM_findEntryWhole|);_%$(|BM_findEntryCS|);_%$(*BM_findEntryRE*);_%$(*BM_findEntryType*);_','NONE');> LetRegNum(2,-1);> Loop(!'SetOK(1);> FindInString(''%!9'',''&'',1,2,1000,%!2+2);> IfOK(!''ReplaceInString(|%!9|,|&&|,%!1,%!2,0,9);'',''Stop;'');'> );> Prompt('No %$(|BM_findEntryType|); entries matching string%\ ''%!9''');",> !"BeginGroup;> ShowList(0,1,!'Do(''%?'');');> EndGroup;"> ); LetReg(0,""); End; //============================================================================= This macro finds all entries containing a specified string (possibly a Regular Expression) and inserts the key from the one you choose. If you invoke the macro from your main TeX file, all \bibliography's will be searched (you have to have LaTeX'ed the file once); if you invoke it from a BibTeX file, only this one will be searched. If you have the MUI Plug-In installed (available from ) you will see a nice dialog. Otherwise it will be a simple edit box. The macro is part of the bibMacros package (available from www.winedt.org), but you don't need that to use it. You only have to read the following, if you are not using the MUI plug-in: |You are prompted to specify a string that the entry you are looking for |must include. This could be, e.g.: | Knuth |which will find all entries including "Knuth", or | Knuth|Computer |which means that an entry must include either "Knuth" OR "Computer". You |can also use the AND-operator "&". E.g.: | Knuth&Computer |will only find entries which contain both words. |The "&" has precedence over the "|", so that the search string | Knuth|Computer&Addison-Wesley |will only return entries which are published by Addison-Wesley, (and which |are written by Knuth and/or are about computers). Not, as one might think, |works by Knuth OR works on computers which are published by Addison-Wesley. |This precedence can currently not be changed. | |Search is case-insensitive. |Spaces will not be removed, so don't type "knuth & computer", unless you |really want to find entries which contain "knuth " and " computer". | |For speed's sake, search results will be stored. If you have edited your |bibliography database in the meantime, you can make WinEdt forget all |results for this file by saying: | reset! |You will then be prompted again for a new search string. If you don't want |to reset *all* search results, you can say: | reset! |which will trigger a new search only for "". | |You will be shown all previous search results for the current file, if you |say: | show! R Schlicht w.m.l@gmx.net //------------------------------------------------------------------------------ $Id: bibFindEntry54.edt,v 1.1 2007-06-07 00:16:04+02 schlicht Exp schlicht $