Viewing 1 post (of 1 total)
  • Author
    Posts
  • #22369
    LifeTimer
    Participant

    As described in this forum thread, it would be super useful to be able to provide parameter data to macros directly from the command-line, in order to be able to use self-contained command-lines for advanced EmEditor tasks on a daily basis (like for example in my case, integrated with other software tools that can invoke external tools by using such command-lines).

    It could look for example like this on the command line:

    emeditor.exe c:\some_dir\some_target_file.txt /mf c:\my_emeditor_macros\delete_every_nth_line.jsee -macroparam “n=3”

    Or like this for multiple parameters:

    emeditor.exe c:\some_dir\some_target_file.txt /mf c:\my_emeditor_macros\delete_every_nth_line.jsee -macroparam “n=3” -macroparam “start_at_line=2”

    Or, to remove the complexity of named parameters, simply using unnamed ordered parameters instead, like this:

    emeditor.exe c:\some_dir\some_target_file.txt /mf c:\my_emeditor_macros\delete_every_nth_line.jsee -macroparam 3 -macroparam 2

    From inside the macro, the parameter data could for example be accessed from a Javascript object that you provide, e.g. called “MacroParameters”, which could either in the simple case with unnamed ordered parameters only be a simple array of strings, or in the little more complex case with named parameters, e.g. be an “associative array” (using Javascript objects and properties), or alternatively perhaps two simple arrays of strings, where one contains the parameter names and one contains the values.

    I really hope that you will consider this enhancement suggestion, since I think it would be a highly useful feature to go with the already super useful possibility to execute macros from the command-line with the “/mf” switch. Thanks for listening!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.