Can I create a macro that gives the desired file name when creating a new file?
andrecool-68 last edited by
Hello to all participants of the forum!
For example, this macro creates a new OEM 866 encoded file for batch, but the file name will always be “new 1”. The file name “new.bat” is required to have a file extension.
<Macro name="NEW.BAT" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="2" message="0" wParam="41001" lParam="0" sParam="" /> <Action type="2" message="0" wParam="46022" lParam="0" sParam="" /> <Action type="2" message="0" wParam="45058" lParam="0" sParam="" /> </Macro>
Terry R last edited by
The file name “new.bat” is required to have a file extension.
You may want to read from this thread in this forum. I had thought the same as you, however the macro failed as the files are ONLY resident within NPP, not real files.
There was some talk later in that thread that it was possible to edit the macro to include the Save As step, although it is not recordable in the normal sense. I don’t think I followed through much on that so can’t confirm there is a path forward to achieve what you want.
Another idea that might work is to have an empty “template” file with the extension, so a real file. Have the macro load that, then rename, or save a copy as, would that work???
PS if successful could you provide the info here as I think there will be many wanting to know how it might be achieved.
Alan Kilborn last edited by
but the file name will always be “new 1”.
I don’t think that’s going to always be true. It would depend upon if you already had an existing
new 1file when this macro is run, then I don’t think what the macro will saw will be saved in
For this kind of automation it is probably best to go with the scripting plugins (e.g. PythonScript) or presumably NppExec can also achieve it.
andrecool-68 last edited by andrecool-68
@Alan-Kilborn For me Python, is a dark forest.