Community
    • Login

    Can I create a macro that gives the desired file name when creating a new file?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 927 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • andrecool-68A Offline
      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>
      
      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Terry RT Offline
        Terry R
        last edited by

        @andrecool-68 said in Can I create a macro that gives the desired file name when creating a new file?:

        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???

        Good luck
        Terry

        PS if successful could you provide the info here as I think there will be many wanting to know how it might be achieved.

        1 Reply Last reply Reply Quote 1
        • Alan KilbornA Offline
          Alan Kilborn @andrecool-68
          last edited by

          @andrecool-68 said in Can I create a macro that gives the desired file name when creating a new file?:

          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 1 file when this macro is run, then I don’t think what the macro will saw will be saved in new 1.

          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-68A mark LossM 2 Replies Last reply Reply Quote 1
          • andrecool-68A Offline
            andrecool-68 @Alan Kilborn
            last edited by andrecool-68

            @Alan-Kilborn For me Python, is a dark forest.

            1 Reply Last reply Reply Quote 1
            • mark LossM Offline
              mark Loss @Alan Kilborn
              last edited by

              @Alan-Kilborn said in Can I create a macro that gives the desired file name when creating a new file?:

              @andrecool-68 said in Can I create a macro that gives the desired file name when creating a new file?:

              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 1 file when this macro is run, then I don’t think what the macro will saw will be saved in new 1.
              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.

              thanks my issue has been fixed.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors