- AuthorPosts
- July 11, 2010 at 12:43 am #8736
user
Participanthello
when you open an image file with Windows XP Image Viewer, and you click ENTER, it opens the next (in alphabetical order) image file that exists in the current folder
can Emeditor do the same with txt files ?
to open the next file in the current folder using a key shortcut (maybe not ENTER, but some else)?
thanks
July 12, 2010 at 5:08 pm #8738Yutaka Emura
KeymasterHi user,
You could write a macro to view the next text file in the current folder by pressing a shortcut key.
July 13, 2010 at 1:38 am #8741user
Participantcan you tell me please how that macro should be
thanksJuly 13, 2010 at 6:04 pm #8742Yutaka Emura
KeymasterThis is an example of the macro that opens the next .txt file in the same folder as the opened file.
// This macro opens the next ".txt" file in the current folder.
//
sFolder = document.Path;
if( sFolder != "" ){
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(sFolder);
fc = new Enumerator(f.files);
sItem = "";
for (; !fc.atEnd(); fc.moveNext()) {
if( fc.item().name == document.Name ) {
for( fc.moveNext(); !fc.atEnd(); fc.moveNext()) {
n = fc.item().name.lastIndexOf(".");
if( n != -1 ){
if( fc.item().name.slice( n ) == ".txt" ){
sPath = sFolder + "" + fc.item().name;
try {
editor.OpenFile( sPath );
}
catch(e){
}
break;
}
}
}
break;
}
}
}
July 13, 2010 at 6:31 pm #8743user
Participantthanks and what are the hotkeys to view the next/previous txt file?
July 13, 2010 at 7:55 pm #8744Yutaka Emura
KeymasterYou can assign any shortcut key from the configuration properties > Keyboard tab. You can select this macro in the My Macros category, and then assign a new key.
July 13, 2010 at 8:07 pm #8745user
Participantdoes this work for the ‘previous’ txt file as well?
thanksJuly 13, 2010 at 10:09 pm #8747Yutaka Emura
KeymasterNo, it doesn’t work with previous text file.
July 14, 2010 at 8:38 pm #8751tonne
ParticipantPrev-file version…
// This macro opens the prev ".txt" file in the current folder.
//
sFolder = document.Path;
if( sFolder != "" ) {
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(sFolder);
fc = new Enumerator(f.files);
sItem = "";
for (; !fc.atEnd(); fc.moveNext()) {
if( fc.item().name == document.Name ) {
try {
editor.OpenFile( sPath );
}
catch(e) {
}
break;
}
else {
n = fc.item().name.lastIndexOf(".");
if( n != -1 && fc.item().name.slice( n ) == ".txt" )
sPath = sFolder + "" + fc.item().name;
}
}
}July 14, 2010 at 9:39 pm #8752user
Participantthat is very useful thanks
but why it appears not well formatted? can you format it as the previous script?
thanks - AuthorPosts
- You must be logged in to reply to this topic.