parameters – EmEditor (Text Editor) https://www.emeditor.com Best Text Editor, Code Editor, CSV Editor, Large File Viewer for Windows (Free versions available) Wed, 06 Sep 2017 07:17:38 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 Enhancement: Possibility to provide macro parameters from the command line https://www.emeditor.com/forums/topic/enhancement-possibility-to-provide-macro-parameters-from-the-command-line/ Wed, 06 Sep 2017 07:13:14 +0000 https://www.emeditor.com/forums/topic/enhancement-possibility-to-provide-macro-parameters-from-the-command-line/ 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!

]]>
How to provide parameters for macros executed from the command line? https://www.emeditor.com/forums/topic/how-to-provide-parameters-for-macros-executed-from-the-command-line/ Mon, 04 Sep 2017 21:53:38 +0000 https://www.emeditor.com/forums/topic/how-to-provide-parameters-for-macros-executed-from-the-command-line/ Using the /mf switch, it is possible to execute a macro on any given file directly from the command line, which is very good!

One big problem with this though is that I haven’t been able to find any way to provide parameters for this macro from this same command line – how can this be done?

A simple example:
I have a macro that will delete every n:th line from the current file, and I want to be able to provide this “n” value (i.e. so that it can delete for example every second line, every third line, every fourth line etc, based on my current choice).

This must be possible somehow, right? But how? I cannot find anything like this in the EmEditor command-line reference?

]]>