• Login
Community
  • Login

Opening read-only files

Scheduled Pinned Locked Moved General Discussion
5 Posts 4 Posters 6.9k 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.
  • J
    Jonathan Rew
    last edited by Jul 11, 2016, 8:38 AM

    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.

    C 1 Reply Last reply Jul 12, 2016, 12:00 AM Reply Quote 1
    • N
      NotepadCpp
      last edited by Jul 11, 2016, 5:14 PM

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

      1 Reply Last reply Reply Quote 0
      • C
        Claudia Frank @Jonathan Rew
        last edited by Jul 12, 2016, 12:00 AM

        @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
        • J
          Jonathan Rew
          last edited by Jul 13, 2016, 6:16 AM

          Thank you both!

          1 Reply Last reply Reply Quote 1
          • F
            Filipe Costa
            last edited by Nov 10, 2017, 4:32 PM

            +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