// -*- ASCII:EDT -*- // importBookmarks.edt // (schlicht 20010815) /////////////////////// // Change the default folder (here: "%B") to // whatever makes sense for you: Browse(1,"Project Files|*.prj","%B"); IfStr("%!1","%!p\%!n%!t","=",> "Prompt('You cannot inport Bookmarks from the current Project.',2,1); Exit;"); ReadFile("%!1",0); LetReg(4,"%p\%n%t"); LetRegNum(3,0); Loop(!`> FindInString("%!0","%!4",2,3,1000,%!3);> IfOK(!"> ExtractByIndex(2,'%!0',%!3+3,%!3+3);> IfStr('%!2','9','<=','','Stop;');",> "Prompt('This file is not part of Project %!1.',2,1); Exit;");> `); SetOK(1); FindInString("%!0","<*>",2,3,1001,%!3-1); FindInString("%!0","<*>",2,3,1001,%!3-1); ExtractByIndex(0,"%!0",%!2,%!3); SetOK(1); // The first 22 numbers don't have anything to do with bookmarks, so skip them: FindInString("%!0","<+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }+[0-9-]@{ }",2,3,0001,0); GetLength(2,"%!0"); ExtractByIndex(0,"%!0",%!3,%!2); SetOK(1); // any bookmarks defined? FindInString("%!0","+{@{ }+[0-9]}",2,3,0001,0); IfOK(!"> ExtractByIndex(0,'%!0',%!2,%!3);> LetRegNum(3,-1);> Loop(!'// Bookmarks are stored in triples of numbers <> SetOK(1);> FindInString(''%!0'',''[0-9]@{ }+[0-9]@{ }+[0-9]'',2,3,1001,%!3+1);> IfOK(!''> LetRegNum(4,-1);> ExtractByIndex(9,|%!0|,%!2,%!3);> // Bookmark number: SetOK(1);> FindInString(|%!9|,|[0-9]|,2,4,1001,%!4+1);> ExtractByIndex(6,|%!9|,%!2,%!4);> // Column number: SetOK(1);> FindInString(|%!9|,|+[0-9]|,2,4,1001,%!4+1);> ExtractByIndex(7,|%!9|,%!2,%!4);> // Line number: SetOK(1);> FindInString(|%!9|,|+[0-9]|,2,4,1001,%!4+1);> ExtractByIndex(8,|%!9|,%!2,%!4);> // Bookmark already set? BookMarkLineNumber(4,%!6);> IfNum(%!4,%!8,|=|,||,> |GotoCL(%!7,%!8+1);> SetBookMark(%!6);> |);> '',> ''Stop;'');> ');> ",> "Prompt('There are no bookmarks for this file in Project %!1',2,1);"> ); LetReg(0,"");LetReg(1,"");LetReg(2,""); LetReg(3,"");LetReg(4,"");LetReg(6,""); LetReg(7,"");LetReg(8,"");LetReg(9,""); End; //////////////////////////////////////// // This macro imports Bookmarks for the // current file from another Project. // // Because Bookmarks are stored in the Project File, // they are not accessible if you've defined them // while working on another project. // This macro lets you choose the Project File, // reads it and sets all bookmarks which it has // found for the current document. // // It doesn't work correct if you have different // wrapping settings for the documents in the // two projects. If the bookmarks are wrong, // simply clear them all (ALT- + ALT- A), // adjust the wrapping and try again. // // R Schlicht w.m.l@gmx.net //////////////////////////////////////// $Id: importBookmarks.edt,v 1.2 2001-11-13 19:03:55+01 standard Exp standard $