Opening read-only files



  • 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.



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



  • @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



  • Thank you both!



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


Log in to reply