Community
    • Login

    Save Backup of Unnamed File - Work in Progress

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 3 Posters 346 Views
    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.
    • NN123616N
      NN123616
      last edited by

      Hi,

      Windows Update keeps eating my files… it’d be amazing if autosave worked on files that weren’t named yet.

      E.g. you start a new Notepad… start writing. and autosave grabs it for say unnamed1.txt

      Is this possible?

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R
        last edited by

        @NN123616 said in Save Backup of Unnamed File - Work in Progress:

        E.g. you start a new Notepad… start writing. and autosave grabs it for say unnamed1.txt
        Is this possible?

        I suggest you start your reading here. This is a FAQ post that gives you lots of information about backup strategy and what Notepad++ offers, both built-in and with plugins.

        If after that you still have questions ask away, but you need to read that first.

        Terry

        1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @NN123616
          last edited by Alan Kilborn

          @NN123616

          you start a new Notepad… start writing. and autosave grabs it for say unnamed1.txt

          Is this possible?

          I don’t know much about it, but maybe the AutoSave plugin will do that. I’ve never actually used that plugin.
          I think the TakeNotes plugin can do such a thing, although it has been a while since I’ve used it.

          If I were doing it for myself, I’d use the PythonScript plugin and a little script, maybe like this:

          # -*- coding: utf-8 -*-
          
          from Npp import *
          import os
          import time
          
          try:
              AUF__callback_npp_BUFFERACTIVATED
          except NameError:
              def AUF__callback_npp_BUFFERACTIVATED(args):
                  if editor.getTextLength() == 0:
                      if not os.path.isfile(notepad.getCurrentFilename()):
                          notepad.saveAs(os.environ['TEMP'] + os.sep + time.strftime("%Y%m%d-%H%M%S", time.localtime()) + '.txt')
              notepad.callback(AUF__callback_npp_BUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED])
          

          This will, instead of doing “unnamed1.txt”, do a timestamp for a filename; example:

          3b364c94-49ff-400d-a05c-49f19d8e91f1-image.png

          This demo puts the file in the folder where the TEMP environment variable points, but that’s easily customized to something else.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors