Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5691
    PaperPlate
    Participant

    This is actually part of a larger “project” to addon on to the FindAll.jsee in the macro section (mighty nice little macro). What I’m trying to do is after doing a FindAll allowing editing of the new file instance.

    So if you were to do a find all on “if” for example, yo would see every line with an “if” in it. Then the user could edit that new tabbed file and run another macro to drop the changes they made back in. So if you only edited one line, say line 200, it would compare, then dump that new line in since it was a change.

    The only way I see to do this in EmEditor (I only started working with EmEditor macros this week*) is to save the file generated by the FindAll macro, then compare that file, using the tags as references) to the original file. But I would want to delete that saved file after so as not to clutter the current directory.

    Another possibility would be to just save to a dump “log” folder and use that as your point of reference, and then not worry about deleting.

    So is this possible at all? Could I create a macro to run on the FindAll (after its saved since I’m pretty sure you couldn’t run on the non saved file since its not saved, or could you?).

    *EmEditor is a great tool, thank you for it!

    #5692
    Yutaka Emura
    Keymaster

    PaperPlate wrote:
    This is actually part of a larger “project” to addon on to the FindAll.jsee in the macro section (mighty nice little macro). What I’m trying to do is after doing a FindAll allowing editing of the new file instance.

    So if you were to do a find all on “if” for example, yo would see every line with an “if” in it. Then the user could edit that new tabbed file and run another macro to drop the changes they made back in. So if you only edited one line, say line 200, it would compare, then dump that new line in since it was a change.

    The only way I see to do this in EmEditor (I only started working with EmEditor macros this week*) is to save the file generated by the FindAll macro, then compare that file, using the tags as references) to the original file. But I would want to delete that saved file after so as not to clutter the current directory.

    Another possibility would be to just save to a dump “log” folder and use that as your point of reference, and then not worry about deleting.

    So is this possible at all? Could I create a macro to run on the FindAll (after its saved since I’m pretty sure you couldn’t run on the non saved file since its not saved, or could you?).

    *EmEditor is a great tool, thank you for it!

    I am not exactly sure what you would like to do, but does FindAll.jsee mean FindAll.vbee at http://www.emeditor.com/modules/mydownloads/singlefile.php?cid=8&lid=172 ?

    You might also want to try “Replace in Files” feature of EmEditor (on the Search menu). You can also try “Search” plug-in of EmEditor.

    #5694
    PaperPlate
    Participant

    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?

    #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.

    #5697
    PaperPlate
    Participant

    Yutaka wrote:
    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.

    When you do a “Find in Files” or, use the FindAll.vbee macro, the output in the new tab is formatted with a tag (a link to the file and the line of that file) with a display of the line it found the search parameter on.

    I am wondering if its possible to activate (click) this tag in a macro to jump to that line in the original file.

    #5698
    Yutaka Emura
    Keymaster

    PaperPlate wrote:

    Yutaka wrote:
    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.

    When you do a “Find in Files” or, use the FindAll.vbee macro, the output in the new tab is formatted with a tag (a link to the file and the line of that file) with a display of the line it found the search parameter on.

    I am wondering if its possible to activate (click) this tag in a macro to jump to that line in the original file.

    Yes, you can use the Tag Jump command.
    http://www.emeditor.com/help/cmd/edit/tag_jump.htm


    editor.ExecuteCommandByID(4147);

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.