- October 27, 2017 at 6:32 pm #22598
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()? :-)November 3, 2017 at 5:58 am #22608
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!November 5, 2017 at 6:02 pm #22610
How about using document.Filter method with eeFindKeepPrevious or eeFindContinue flag?November 6, 2017 at 2:27 am #22611
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.November 6, 2017 at 5:38 pm #22612
I will look into this suggestion. Thanks for explanation!November 7, 2017 at 6:12 am #22616
Great, thanks a lot Mr Emura, as usual!November 21, 2017 at 9:38 am #22635
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,November 21, 2017 at 1:57 pm #22639
Super, thanks a lot as usual for being responsive to feature requests!
- You must be logged in to reply to this topic.