Creating a simple Open File macro?

Started by: Display Error2 voices3 posts

Hello, I'd like select some text which is a file path e.g. C:\temp\file.txt and run a macro to open that file path in EmEditor (I can then assign that macro to the context menu). I tried to record a macro; it copies the highlighted text but obviously stops recording at the Open Dialog. I also tried the following code, but I clearly don't know what I'm doing!
document.selection.Copy(eeCopyUnicode);
editor.OpenFile(eeCopyUnicode);
Thank you for any help!
If you would like to open the selected path, you can write a macro like this:
editor.OpenFile( document.selection.Text, 0, eeOpenAllowNewWindow );
Please see: http://www.emeditor.org/en/macro_editor_editor_openfile.html
I seee! So there's no need to copy the text to clipboard, just use the actual selected text! The macro documentation makes more sense to me now :) Thanks a lot Yutaka, that works perfectly :)

3 posts in this topic