- November 11, 2008 at 3:42 am #6562November 12, 2008 at 1:31 am #6566webernMember
A basic example. Apply it only for selected text.
var STR = Text;
var mud = "";
var endPos =0 ;
endPos = STR.lastIndexOf("<");
mud = STR.substr(endPos);
STR = STR.substr(0,endPos);
Text = '<a href="' + STR + '" target="blank">' + STR + '</a>' + mud;
} else Text = '<a href="' + STR + '" target="blank">' + STR + '</a>' + "<br>";
}November 15, 2008 at 1:53 am #6599
Thank you for the basic script, webern
I like the way you can copy an url an use it as the anchor. This script is usefull if you have to convert 1 url, because you have to select this first. But for a list in this format it will not work….November 15, 2008 at 4:17 am #6601webernMember
see PMNovember 16, 2008 at 12:28 pm #6612
You might want to try a script that is designed for this purpose. One example is txt2tags.November 16, 2008 at 7:56 pm #6614
impressive script :-)
Personally I use http://virdi-software.com/txt2web/ to create the base for my html pages. But I want to convert a simple page by using a macro in the Emeditor environment. Macros are easy to adjust and to combine with other macros.November 16, 2008 at 8:54 pm #6615
That makes sense. Just as a reminder (to others who may read this, in case you already know) EmEditor allows you to create a macro that runs an external script as well. This is a built-in feature of windows scripting host.
You can mix EmEditor macro code with the code that someone else has written so that you never have to leave the editor to do anything you want. This means you never actually have to write custom code (ulness you prefer to do so of course).
This aspect of EmEditor (direct support for windows scripting host) is really powerful, and as far as I have seen, unique for windows editors. Even editors that support macro scripting don’t usually integrate with the windows scripting host.
Sounds very interesting.
I’m not a programmer, so I work most of time with macros (easy to use).
If someone knows a good tutorial or examples related to this function, please post!
Thx dreftymac for pointing me to this one. :-)November 18, 2008 at 2:53 am #6625
Although this is not an example of converting html, it is an introduction to the “Run” feature of the windows scripting host:
var shell = new ActiveXObject(“WScript.Shell”);
shell.Run(“”C:Program FilesInternet ExplorerIExplore.exe”http://www.emeditor.com”);
This example will work on most systems to open MSIE. You can paste this into an EmEditor macro file and run it. The important point is that all macros in EmEditor are also scripts that you can run in regular Windows. This is useful because it means anything you can do from Windows, you can do it from inside EmEditor also.
An example for converting html could be to create a macro that runs HTMLTidy against the currently-focused document in EmEditor, where you just pass the path to HTMLTidy and the path of the current document to EmEditor.
For those who are not programmers, but willing to learn a little bit about Windows Scripting in order to get more out of EmEditor macros, a good thing to try is a search on your favorite search engine:
“What is WSH”
“What is Windows Scripting Host”
If you are familiar with EmEditor macros, you are already familiar with WSH, so you may want to take a moment to read some of the tutorials and the reference from Microsoft.November 20, 2008 at 8:41 am #6639
Thanks again, dreftymac. I really appreciate your help. :-)
- You must be logged in to reply to this topic.