Community
    • Login

    Opening read-only files

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 4 Posters 6.8k 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.
    • Jonathan RewJ
      Jonathan Rew
      last edited by

      I’ve been using Notepad ++ for a couple of years now and think it is the best text editor that I have so far used.

      I used to use SciTE and there’s only one feature in that which would be very useful (for me): when opening a read-only file (eg like a template), you were able to edit it and then were forced to save it under a different name.

      Would you be able to add that feature?

      Many thanks.

      Claudia FrankC 1 Reply Last reply Reply Quote 1
      • NotepadCppN
        NotepadCpp
        last edited by

        Open the file; Hit Ctrl+A, Crtl+C, Cntrl+W, Cntrl+N, Cntrl+V, Cntrl+S

        1 Reply Last reply Reply Quote 0
        • Claudia FrankC
          Claudia Frank @Jonathan Rew
          last edited by

          @Jonathan-Rew

          what you could do in addition would need to install python script plugin and those four lines of code.

          def callback_MODIFYATTEMPTRO(args):
              notepad.menuCommand(MENUCOMMAND.FILE_SAVEAS)
          
          editor.clearCallbacks([SCINTILLANOTIFICATION.MODIFYATTEMPTRO])
          editor.callback(callback_MODIFYATTEMPTRO, [SCINTILLANOTIFICATION.MODIFYATTEMPTRO])
          

          What it does:
          By registering the callback the script gets notified when you try to change a read only file and therefore calls
          the file save as dialog. You can either create a script but than you need to run it every time you start npp or
          you put the content into the startup.py of the python script plugin then it get called automatically every time
          npp starts.

          What needs to be done first is described here

          Just in case that you haven’t installed python script plugin yet, I would propose to use the MSI package instead of using the plugin manager.

          Cheers
          Claudia
          Cheers
          Claudia

          1 Reply Last reply Reply Quote 1
          • Jonathan RewJ
            Jonathan Rew
            last edited by

            Thank you both!

            1 Reply Last reply Reply Quote 1
            • Filipe CostaF
              Filipe Costa
              last edited by

              +1 for this.
              The Clear Read-Only Flag should not be an option and it should behave like that by default.

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