Community
    • Login

    Macro that changes file encoding and then saves?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 1.7k Views 2 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.
    • Clay GibneyC Offline
      Clay Gibney
      last edited by

      I’m hoping to record a macro that will ‘convert to UTF-8’ and then save the file to a specific file name. I tried to use the “Start Recording” feature for this, but those actions aren’t captured. Is it possible to manually write a macro to do all of that?

      dinkumoilD 1 Reply Last reply Reply Quote 0
      • dinkumoilD Offline
        dinkumoil @Clay Gibney
        last edited by dinkumoil

        @Clay-Gibney

        It should be possible with one of the scripting plugins available, e.g. NppExec. This plugin (like others as well) allows to create a menu entry in the Macro menu which can be assigned to a keyboard shortcut.

        But you should elaborate more precisely what you meant with

        @Clay-Gibney said:

        a specific file name

        Automatically generated from the original file name, following a certain rule? Or provided by user by opening a file selector dialog?

        1 Reply Last reply Reply Quote 3
        • Clay GibneyC Offline
          Clay Gibney
          last edited by

          Thank you. I have a daily task where I open a uniquely named CSV file, and I have to encode it to UTF-8 and then perform a Save-As to a specific file name so I can then upload it into another system. So I was hoping to turn a few of those steps into a macro/menu choice.

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA Online
            Alan Kilborn @Clay Gibney
            last edited by

            @Clay-Gibney

            I guess we won’t know if you can achieve this unless you give @dinkumoil 's suggestion a try and report back on how it goes…

            1 Reply Last reply Reply Quote 1
            • Clay GibneyC Offline
              Clay Gibney
              last edited by

              The NppExec plugin did the trick! Just two simple lines were all I needed:
              npp_menucommand Encoding\Convert to UTF-8
              NPP_SAVEAS: c:\users\clay\downloads\people.csv

              1 Reply Last reply Reply Quote 4

              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