Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #22598
    LifeTimer
    Participant

    It would be extremely useful to have an option for document.filters.Import() that would allow it to append the imported filter to the (possibly) already applied filter of the current document, rather than always just replacing it, as it currently does.

    This option could typically be implemented as a second (optional) flags parameter to the filters.Import() method, which would make it fully backwards compatible too.

    As you can understand, this would make it possible for macros to perform extremely complex dynamic filtering of documents, depending on the logic of the macro itself, while the filter templates that it uses can still be originally created by humans and stored in the different filter files that are imported by the macro, step-by-step, in this way.

    Pretty please with sugar on top could we have this new flag for document.filters.Import()? :-)

    #22608
    LifeTimer
    Participant

    Any chance to get a reply to this from Mr Emura?

    This suggested (and easy to implement) feature would be extremely useful to me, and most likely many others too!

    #22610
    Yutaka Emura
    Keymaster

    Hello LifeTimer,

    How about using document.Filter method with eeFindKeepPrevious or eeFindContinue flag?

    #22611
    LifeTimer
    Participant

    Thanks for your reply Mr Emura!

    To answer your question, let’s say that for some certain document, I have two different complex filters (10+ filter levels targeting different columns with different filtering options etc). I have many such complex filters that I use daily in EmEditor myself.

    In order to be able to apply both these filters to the target document from a macro at the same time (i.e. the same thing as if the exported macro files would be appended before being re-imported as a single imported filter), using the method you suggest above, I would have to emulate the entire filter import functionality of EmEditor from my own macro, i.e. parsing the exported filter TSV files myself (or even emulating the export functionality too, and storing the filter data in my own custom files on disk), and then read the saved filter data line by line, applying each individual filter level from these custom-parsed exported filters to the target document using the flags for document.Filter() that you suggest above.

    This seems very inefficient and long-winded considering the excellent import/export functionality that is already implemented directly in EmEditor (i.e. the document.filters.Import() and document.filters.Export() methods), so what I’m suggesting here is to instead just make the minimal addition to the document.filters.Import() method of allowing it to support these two flags directly, which would then allow the user to apply both the two complex filters in this example to the target document at the same time, simply by making two subsequent calls to document.filters.Import(), with the eeFindContinue used for the first call, and the eeFindKeepPrevious flag used for the second call.

    As I have hopefully been able to explain with this example, this small addition would make the macro-scriptable filtering capabilities of EmEditor a whole order of magnitude more powerful, which seems like a very good “implementation time”/benefit quota to me!

    Please let me know if my explanation is still unclear, and I will do my best to fill in the blanks.

    #22612
    Yutaka Emura
    Keymaster

    I will look into this suggestion. Thanks for explanation!

    #22616
    LifeTimer
    Participant

    Great, thanks a lot Mr Emura, as usual!

    #22635
    Yutaka Emura
    Keymaster

    Hello,

    The next version (v17.2.5) will add the second parameter (bAppend) to the Import() method. If bAppend is true, the Import() method will append the filters. If the second parameter is omitted, bAppend is assumed as false.

    Thanks,

    #22639
    LifeTimer
    Participant

    Super, thanks a lot as usual for being responsive to feature requests!

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