#5696
Yutaka Emura
Keymaster

PaperPlate wrote:
I’ll just ask it as a bunch of questions, since I did kind of ramble! I did mean the find all macro you listed, though I did retool it a bit (and rewrote it in .js, that is where the confusion came from).

1) Is it possible to delete a file using EmEditor macros?
2) Or, possible to delete a file using a plugin?
3) Can the macro module activate a “tag” in a document?

Let us say I use the FindAll.vbee macro in the following file using the search string, “if”

If a == b
ElseIf b > 1
Message “Hello world!”
End
End // If
#—-

FindAll would give me:

c:/filename/etc/etc/etc.etc(1): If a == b
c:/filename/etc/etc/etc.etc(2): ElseIf B > 1
c:/filename/etc/etc/etc.etc(5): End // If

Now lets say I edited the text that was displayed after I did the FindAll, on line two to (since “Hello world!” would never message with the current logic):

“c:/filename/etc/etc/etc.etc(1): If a != b”

After running the new macro it would compare your original file to the FindAll output you editted, then replace the lines you edited back into your original file, using the tags as references.

Long post but, is this possible with EmEditor?

Yes, you can use DeleteFile Method of FileSystemObject.
http://msdn2.microsoft.com/en-us/library/thx0f315(VS.85).aspx
See also http://www.emeditor.com/help/macro/tutorial/tutorial_copyfile.htm


if( document.FullName == '' ){
alert( "The file is untitled." );
}
else {
fso = new ActiveXObject( "Scripting.FileSystemObject" );
fso.DeleteFile( document.FullName );
}

I don’t know what you mean by “activate a tag”. If you want to select a certain document (tab), then you can do using Documents colleciton and Document.Activate method.

The FindAll output you edit will not be reflected automatically.