Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #9004
    chjfth
    Member

    Hello, Yukata. If I use


    n = document.selection.Replace( "<(.+)>", "@1", eeReplaceSelOnly+eeFindReplaceRegExp);

    to replace current selected text to something, how can I make resulting text still selected(displayed in inverted color).

    If the resulting text is selected, I can count its text length, save it to a variable for further processing etc.

    Please advise.

    #9009
    Yutaka Emura
    Keymaster

    Hello chjfth,

    There is no easy way to do this, but I wrote this code for you:

    if( document.selection.Find( "<(.+)>", eeFindReplaceRegExp | eeFindNext) ){
    x1 = document.selection.GetTopPointX( eePosLogical );
    y1 = document.selection.GetTopPointY( eePosLogical );
    x2 = document.selection.GetBottomPointX( eePosLogical );
    y2 = document.selection.GetBottomPointY( eePosLogical );

    sLine1 = document.GetLine( y2 );
    document.selection.Replace( "<(.+)>", "@1", eeFindReplaceRegExp);
    sLine2 = document.GetLine( y2 );
    x2 += sLine2.length - sLine1.length;

    document.selection.SetActivePoint( eePosLogical, x1, y1 );
    document.selection.SetActivePoint( eePosLogical, x2, y2, true );
    }

    I am sorry, but this code doesn’t support eeReplaceSelOnly flag. I still hope this helps.

    #9011
    chjfth
    Member

    Thank you for replying. Hope you can provide an easy way to accomplish that. For example, add a flag to Replace so that replaced text is selected automatically.

    #9114
    snovic
    Participant

    Hi gays, this is my very first post at forum, and please don’t be angry, because I don’t know how to make new post (thread) and where.
    Moderator will probably move this at right place.

    I have this question about recording makro(s):

    When in Sokoban for Windows 2.3 build 6 I save some game as *.xsb file, I have this situation

    http://photoserver.ws/images/Bqnt4cee47932c50b.png

    and I need this one

    http://photoserver.ws/images/Yaqz4cee479351727.png

    So, I need to remove all unnecessary caracters from file at first picture, to make file at second, to be able to load that file in Sokoban Puzzle solver v3.7.2

    http://codecola.net/

    I wish to record Macro which will remove unnecessary tekst from *.xsb files.
    This is 5 operations:
    1) Remove text above the first pair …
    2) Remove text bellow the last pair …
    For this I use Cut from menu
    3) Remove all remaining caracters
    3) Remove all remaining caracters
    For this I use Search -> Replace ->Replase All, and than replace and with empty caracter
    5) Save that file like *.xsb

    Is it possable to make one macro for this, or I must use combination of several macros?

    #9122
    Yutaka Emura
    Keymaster

    I made a macro for you. Please let me know if you have any questions. Thank you!


    document.selection.StartOfDocument(false);
    document.selection.Find("^s*?<L>.*?</L>",eeFindNext | eeFindSaveHistory | eeFindAround | eeFindReplaceRegExp);
    document.selection.CharLeft(false,1);
    document.selection.StartOfDocument(true);
    document.selection.Delete(1);
    document.selection.EndOfDocument(false);
    document.selection.Find("<L>.*?</L>s*?$",eeFindPrevious | eeFindSaveHistory | eeFindAround | eeFindReplaceRegExp);
    document.selection.CharRight(false,2);
    document.selection.EndOfDocument(true);
    document.selection.Delete(1);
    document.selection.Replace("^s*?<L>(.*?)</L>s*?$","1",eeFindNext | eeFindSaveHistory | eeReplaceAll | eeFindReplaceRegExp);

    #9127
    snovic
    Participant

    I supose, you write previous macro for me, thank you very much for your time and response.

    Shall I copy this in Notepad with *jsee extension, or copy in EmEditor? I don’t know how to save and use this macro.

    I apologize, I never befor haven’t used macros.

    Update: I tryed to make macro in EmEditor with entering row by row from your file, with using enter for each row, and macro recorder activ with *jsee extension by save.
    Result is something strange, which open several windows aplications at attempt to use it on file like on my first puzzle picture.
    Probably I maked bad job.

    #9128
    Yutaka Emura
    Keymaster

    Hi snovic,

    You shouldn’t use the macro recorder when you use my macro.
    Please open a new file, paste the above macro, and save it as “a.jsee”.
    Please select “Select…” on the Macros menu to select this macro (a.jsee).
    Then open a .xsb file, and click “Run Macro a.jsee” on the Toolbar.
    I hope this helps.

    #9131
    snovic
    Participant

    Something is wrong again

    http://photoserver.ws/images/2D2P4cf3a7a32ea21.png

    probably I make again some mistake. I saved macro like “xsb Generator.jsee”, maybe is that wrong? I use text configuration.
    I must thank you again for your time and patiens, EmEdiror’s help is brilliant, unfortynetly for me, with tehnical stuff I don’t understand well.

    Where to find aproved EmEditor macros, which I can download and use?
    And at video section I can’t find what I need, i.e. how to use macro with files from another aplications.

    #9132
    Yutaka Emura
    Keymaster

    Hi snovic,

    eeFindSaveHistory is a new flag introduced on new version of EmEditor. I recommend you use the latest version of EmEditor, currently v10. If you need to use an old version, please remove “eeFindSaveHistory | ” from the macro.

    Thank you,

    #9133
    snovic
    Participant

    Many thanks Mr. Yutaka, now it works, finaly!

    I am still interested in whether the activities of the mouse can be saved as macros. For example, open, and select options from the drop-down menu from toolbar, as for example replacing characters in a text file.
    And specifically, can you make a macro that would delete (selected and) highlighted text.

    #9134
    Yutaka Emura
    Keymaster

    Hi snovic,

    Unfortunately, the macro recorder can only record keyboard activities in the editor. It can record mouse activities toward other applications, but it won’t record mouse activities within EmEditor.

    To delete selected text,

    document.selection.Delete();

    is the macro you need.

    Please let me know if you have further questions.

    Thank you,

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