//-*- ASCII:EDT -*- // openlink.edt // (schlicht 20010307) //////////////////////// // opens different kinds of // HTML links, including: // internal and external # references, // URL-style file descriptions, // and folders. ////////////////////////////////// Mark(0); SaveFind; LetReg(0,"%?"); GetLength(3,'%!0'); // Is it a browser-like file description? FindInString("%!0","file:///?|",1,2,0001,0); IfOK(!`> ExtractByIndex(0,"%!0",%!2,%!3);> ReplaceInString("%!0",":/",1,2,0,0); > LetReg(9,"")`,> !`LetReg(9,"%p/")`); // A folder? ExtractByIndex(4,"%!0",%!3-1,%!3-1); IfStr("%!4","/","=",!"UnixToDos('%!9%!0',0); Browse(0,'*.*','%!0'); Exit;"); IfStr("%!4","\","=",!"UnixToDos('%!9%!0',0); Browse(0,'*.*','%!0'); Exit;"); // A reference? FindInString("%!0","#",1,2,0000,0); IfOK(!`> ExtractByIndex(5,'%!0',%!1+1,%!3);> IfNum(%!1,0,"=","",> !"ExtractByIndex(2,'%!0',0,%!1-1);> LetReg(2,'%!9%!2');> Open('%!2');");> CMD("Go To Beginning Of File");> SetFindCenterLine(1);> SetFindStr("name=""%!5""");> SetSearchForward(1);> SetSearchEntire(0);> SetSearchCaseSensitive(0);> SetRegEx(0);> SetSel(0);> IfFound("","Beep(0); Goto(0);");> RestoreFind;> Exit;> `); Open("%!9%!0"); RestoreFind; End; //////////////////////////////////// // This macro should be specified as // the response to a double-click on a // HREF-link. // Do this by creating two Active Strings // (in Options|Settings) // HREF="?" and // href="?". // Check "Dbl-Click", on Type "HTML" and // put the line: // Exe("%B\Macros\HTML\openlink.edt") // (if that is where you put the macro) // in the field below. // It will then override WinEdt's // "Open On Double-Click" feature, // that misses some of the links. // // If you know how to open a // http://... - link in WinEdt, // (i.e. by getting the source from the // browser), please mail me. // I would be glad to include it in // this macro. // // R Schlicht w.m.l@gmx.net ///////////////////////////////////// $Id: openlink.edt,v 1.4 2001-11-29 15:24:46+01 standard Exp standard $