<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Autosave development request]]></title><description><![CDATA[<p dir="auto">I am still using the deprecated Autosave v 1.4 by Franco Stellari.<br />
Now, I very much like it when the Notepad++ window loses focus to save all open files.<br />
It allows for a much quicker workflow for me when testing code on the fly.<br />
This version has several bugs in combination with the latest Notepad version and will be deactivated when installing.</p>
<p dir="auto">Since this Plugin is no longer maintained by the original developer I was wondering if anyone else can pick up from where he left.<br />
I myself lack the skills to do it, but I hope someone else does.<br />
I would be eternally grateful for such a Plugin and am willing to donate.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/11581/autosave-development-request</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 06:55:31 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/11581.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Apr 2016 12:27:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Autosave development request on Thu, 13 Oct 2016 18:35:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/franco-stellari" aria-label="Profile: Franco-Stellari">@<bdi>Franco-Stellari</bdi></a> Last time I checked I only had the double new 1 file problem when Autosave is enabled.<br />
I’ll try the TakeNotes plugin, sounds what I needed for a long time. Thanks</p>
<p dir="auto">Regarding the deactivation: If you use the installer, NPP deems your plugin as not stable (and says so) and will move it to the disabled folder. Sad but true.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18422</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18422</guid><dc:creator><![CDATA[decoderman]]></dc:creator><pubDate>Thu, 13 Oct 2016 18:35:34 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Thu, 13 Oct 2016 10:47:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/decoderman" aria-label="Profile: decoderman">@<bdi>decoderman</bdi></a> what does it mean that “your plugin gets deactivated”?<br />
I use a portable version and when I copy the new notepad++ files and start, the plugin does not get deactivated… why would it be?</p>
<p dir="auto">Regarding your scenario, it does not have anything to do with Autosave per se. In fact you will obtain the same behavior in normal use without Autosave enabled:</p>
<ol>
<li>Double click files tab new file opens, called “new 1”</li>
<li>Manually save the file as “new 1”</li>
<li>Double click files tab again and a new file opens, called also “new 1”</li>
<li>Manually save the file as “new 1”… obviously it get overwritten</li>
</ol>
<p dir="auto">In some older version the new file created by NPP kept increasing so you would not get a second “new 1”.</p>
<p dir="auto">I think what you want to do is create unique empty files and that is achieved using TakeNotes plugin.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18399</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18399</guid><dc:creator><![CDATA[Franco Stellari]]></dc:creator><pubDate>Thu, 13 Oct 2016 10:47:18 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Thu, 13 Oct 2016 06:11:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/franco-stellari" aria-label="Profile: Franco-Stellari">@<bdi>Franco-Stellari</bdi></a> Altough your plugin gets deactivated every time NPP is updated, I always copy the .dll back into the plugins folder.<br />
For my workflow it works best when opened unsaved files are auto saved when loosing focus.<br />
That still works to my full satisfaction with v1.4.<br />
My settings:</p>
<ul>
<li>when losing focus</li>
<li>All open files</li>
<li>Overwrite existing file</li>
<li>Save (overwrite) silently to tmp dir</li>
</ul>
<p dir="auto">Scenario:<br />
Double click Files Tab, a new file opens called new1.</p>
<ul>
<li>Write something, NPP loses focus, file gets saved to tmp dir, overwriting existing one. Correct behavior.</li>
<li>Double click files tab again, new file opens, also called new1</li>
<li>type something, NPP loses focus and the new new1 overwrites the old new1 file.<br />
The new file creation with the same filename in such a way only happens if your plugin is activated.<br />
Normal behavior by NPP is to name the second new file new2.</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/18397</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18397</guid><dc:creator><![CDATA[decoderman]]></dc:creator><pubDate>Thu, 13 Oct 2016 06:11:57 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Wed, 12 Oct 2016 12:38:19 GMT]]></title><description><![CDATA[<p dir="auto">Can you be more specific on what the issue may be with newer version?<br />
I have not been able to see the problem.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18386</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18386</guid><dc:creator><![CDATA[Franco Stellari]]></dc:creator><pubDate>Wed, 12 Oct 2016 12:38:19 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Mon, 11 Apr 2016 13:31:42 GMT]]></title><description><![CDATA[<p dir="auto">Hugs and kisses to you Claudia!</p>
<p dir="auto">I copied my last posts code into the machine <a href="http://startup.py" rel="nofollow ugc">startup.py</a>, removed the user <a href="http://startup.py" rel="nofollow ugc">startup.py</a> and have no more errors.<br />
It was likely an indentation error on my side.</p>
<p dir="auto">This is on Windows 10 64bit, npp 6.9.1.<br />
Your ‘hack’ works way better than I would have hoped for.<br />
Goodbye Autosave 1.4 by Franco Stellari.<br />
I warmly welcome Autosave 1.0 by Claudia Frank!</p>
<p dir="auto">Cheers<br />
Martin</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15282</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15282</guid><dc:creator><![CDATA[decoderman]]></dc:creator><pubDate>Mon, 11 Apr 2016 13:31:42 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Mon, 11 Apr 2016 11:09:33 GMT]]></title><description><![CDATA[<p dir="auto">Hello Martin,</p>
<p dir="auto">does this happen immediately and always when npp looses focus?<br />
Or randomly?<br />
Could you double check that saveFiles is part of the hook class? Indentation?<br />
Do you use user startup or machine <a href="http://startup.py" rel="nofollow ugc">startup.py</a>?<br />
Just tested it on my windows 7 and npp 6.9.1 - it works.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15269</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15269</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Mon, 11 Apr 2016 11:09:33 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Sun, 10 Apr 2016 23:08:53 GMT]]></title><description><![CDATA[<p dir="auto">Hi Claudia</p>
<p dir="auto">I have worked all weekend long with your first code and never once had a problem!<br />
This is working extremely well. Thank you.</p>
<p dir="auto">Now, with your additional saveFiles I get the following error:</p>
<pre><code>Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 314, in 'calling callback function'
  File "C:\Users\&lt;user&gt;\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\startup.py", line 33, in MyWndProc
    self.saveFiles()                                                            # we can start saving the files
AttributeError: Hook instance has no attribute 'saveFiles'
</code></pre>
<p dir="auto">The complete <a href="http://startup.py" rel="nofollow ugc">startup.py</a> looks like so now:</p>
<pre><code>import ctypes, os                                                                           # import needed modules
from ctypes.wintypes import LONG, HWND, UINT, WPARAM, LPARAM                                # import needed types    

SetWindowLong = ctypes.windll.user32.SetWindowLongA                                         # used to subclass npp window
CallWindowProc = ctypes.windll.user32.CallWindowProcA                                       # used to send message to npp
FindWindow = ctypes.windll.user32.FindWindowA                                               # used to find npp window handle

WndProcType = ctypes.WINFUNCTYPE(LONG, HWND, UINT, WPARAM, LPARAM)                          # callback prototype

GWL_WNDPROC = -4                                                                            # used to set a new address for the window procedure
WM_ACTIVATEAPP = 0x001C                                                                     # message we are interested in

NewFileDir = 'F:\\npp\\'
NewFileExt = '.txt'

class Hook():                                                                               # hook class

    def __init__(self):                                                                     # class constructor
        self.nppHandle = FindWindow('Notepad++',None)                                       # find npp window handle and store it
        
    def register(self):                                                                     # function to register the hook, first
        self.newWndProc = WndProcType(self.MyWndProc)                                       # get the address of our wndproc
        self.oldWndProc = SetWindowLong(self.nppHandle, GWL_WNDPROC, self.newWndProc)       # register it and receive old wndproc address
        console.editor.setProperty('oldWndProc', self.oldWndProc)                           # store it to be able to unregister it needed
        
    def unregister(self):                                                                   # function to unregister hook
        self.prevWndProc = console.editor.getProperty('oldWndProc')                         # receive previously stored wndproc address
        dummy = SetWindowLong(self.nppHandle, GWL_WNDPROC, int(self.prevWndProc))           # register it - return isn't interesting 

    def MyWndProc(self, hWnd, msg, wParam, lParam):                                         # our own wndproc function receives windows messages
        if msg == WM_ACTIVATEAPP:                                                           # if it is WM_ACTIVATEAPP and 
            if wParam == False:                                                             # if wparam is false then npp has lost focus and
                self.saveFiles()                                                            # we can start saving the files

        return CallWindowProc(self.oldWndProc, hWnd, msg, wParam, lParam)                   # IMPORTANT we need to pass received msg to npp, otherwise npp will be blocked.

	def saveFiles(self):
		buf = notepad.getCurrentBufferID()                                                  # remember current document id
		
		for f in notepad.getFiles():                                                        # loop through all files and
			if os.path.isfile(f[0]):                                                        # check if file is real (no new X file)
				notepad.activateBufferID(f[1])                                              # if so, switch to the doc
				if notepad.getCurrentBufferID() == f[1]:                                    # and check if we have the focus we want (and ignore hidden files)
					notepad.save()                                                          # now save it.
			else:                                                                           # here &lt;- looks like this is a new x file
				notepad.activateBufferID(f[1])                                              # switch to the doc
				if notepad.getCurrentBufferID() == f[1]:                                    # and check if we have the focus we want (and ignore hidden files)
					counter = 0                                                             # initial counter
					filename = f[0]                                                         # get filename from tuple
					while os.path.isfile(NewFileDir + filename + NewFileExt):               # loop - check if file already exists
						counter += 1                                                        # yes, increase counter
						filename = filename[:-1] + str(counter)                             # create new filename based on counter
					notepad.saveAs(NewFileDir + filename + NewFileExt)                      # filename is unique, now save it as ...
		
		notepad.activateBufferID(buf)                                                       # switch back to initial doc
        
_hook = Hook()                                                                              # get a instance of our class

if console.editor.getProperty('Hookstatus') != '1':                                         # see if this call is used to register or unregister our wndproc
    console.editor.setProperty('Hookstatus', '1')                                           # it is the first call or call to register it again
    _hook.register()                                                                        # let's do it
else:                                                                                       
    console.editor.setProperty('Hookstatus', '0')                                           # we should unregister our hook
    _hook.unregister()                                                                      # so we do it.
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/15263</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15263</guid><dc:creator><![CDATA[decoderman]]></dc:creator><pubDate>Sun, 10 Apr 2016 23:08:53 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Sun, 10 Apr 2016 17:08:31 GMT]]></title><description><![CDATA[<p dir="auto">Hello Martin,</p>
<p dir="auto">no, afaik I can’t force npp to open as new 2 or whatever needs to be open next but what we can do is to save it with the<br />
next number by checking if a new 2 already exists.<br />
Save function needs to be changed like</p>
<pre><code>def saveFiles(self):
    buf = notepad.getCurrentBufferID()                                                  # remember current document id
    
    for f in notepad.getFiles():                                                        # loop through all files and
        if os.path.isfile(f[0]):                                                        # check if file is real (no new X file)
            notepad.activateBufferID(f[1])                                              # if so, switch to the doc
            if notepad.getCurrentBufferID() == f[1]:                                    # and check if we have the focus we want (and ignore hidden files)
                notepad.save()                                                          # now save it.
        else:                                                                           # here &lt;- looks like this is a new x file
            notepad.activateBufferID(f[1])                                              # switch to the doc
            if notepad.getCurrentBufferID() == f[1]:                                    # and check if we have the focus we want (and ignore hidden files)
                counter = 0                                                             # initial counter
                filename = f[0]                                                         # get filename from tuple
                while os.path.isfile(NewFileDir + filename + NewFileExt):               # loop - check if file already exists
                    counter += 1                                                        # yes, increase counter
                    filename = filename[:-1] + str(counter)                             # create new filename based on counter
                notepad.saveAs(NewFileDir + filename + NewFileExt)                      # filename is unique, now save it as ...
    
    notepad.activateBufferID(buf)                                                       # switch back to initial doc
</code></pre>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15259</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15259</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sun, 10 Apr 2016 17:08:31 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Sat, 09 Apr 2016 08:17:30 GMT]]></title><description><![CDATA[<p dir="auto">Hello Claudia</p>
<p dir="auto">That appears to be working very well, thank you!<br />
I have done some testing with remote files opened with WinSCP and that has also worked so far.<br />
Very promising indeed.</p>
<p dir="auto">The next step is to use it later today, doing some productive work in the way I usually do.</p>
<p dir="auto">One thing I noticed is the new file creation.<br />
Say, I double click the tab bar for a new file and it opens as ‘new 1’.<br />
I enter some text and have it Autosave to ‘new 1.txt’. So far so good, works as intended.</p>
<p dir="auto">Now I double click again for another new file and I get another instance of ‘new 1’.<br />
Entering text and have it Autosave overwrites the existing and still open ‘new 1.txt’ file.<br />
Is  there any way you could know that npp should open ‘new 2’ instead of ‘new 1’ when the ‘new 1.txt’ is already open in npp?</p>
<p dir="auto">I have tried this without the .txt extension by removing the " + NewFileExt" on line 48 of your code.<br />
It is the same outcome.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15249</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15249</guid><dc:creator><![CDATA[decoderman]]></dc:creator><pubDate>Sat, 09 Apr 2016 08:17:30 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Fri, 08 Apr 2016 23:43:58 GMT]]></title><description><![CDATA[<p dir="auto">Hello Martin,</p>
<p dir="auto">this is not only a bit of a hack it is a serious hack you should know that it might be able that it will crash your<br />
npp if something unforeseen happens.<br />
The reason is because we subclass npps message queue which means npp doesn’t get the messages first,<br />
python script plugin gets the messages and after checking if the message in question has been received it<br />
passes it to npp. So be warned.</p>
<p dir="auto">I wouldn’t recommend that you put the whole code into <a href="http://startup.py" rel="nofollow ugc">startup.py</a> as long as you didn’t test if everything works as expected.<br />
If you execute the script it registered the hook, it you run it another time it unregisters it and everything should be as it was before.</p>
<p dir="auto">You only need to modify two variables.</p>
<pre><code>NewFileDir = 'D:\\tests\\npp\\'
NewFileExt = '.txt'
</code></pre>
<p dir="auto">NewFileDir should point to the directory where “New X” files should be stored and<br />
NewFileExt which extension should be used.</p>
<pre><code>import ctypes, os                                                                           # import needed modules
from ctypes.wintypes import LONG, HWND, UINT, WPARAM, LPARAM                                # import needed types    

SetWindowLong = ctypes.windll.user32.SetWindowLongA                                         # used to subclass npp window
CallWindowProc = ctypes.windll.user32.CallWindowProcA                                       # used to send message to npp
FindWindow = ctypes.windll.user32.FindWindowA                                               # used to find npp window handle

WndProcType = ctypes.WINFUNCTYPE(LONG, HWND, UINT, WPARAM, LPARAM)                          # callback prototype

GWL_WNDPROC = -4                                                                            # used to set a new address for the window procedure
WM_ACTIVATEAPP = 0x001C                                                                     # message we are interested in

NewFileDir = 'D:\\tests\\npp\\'
NewFileExt = '.txt'

class Hook():                                                                               # hook class

    def __init__(self):                                                                     # class constructor
        self.nppHandle = FindWindow('Notepad++',None)                                       # find npp window handle and store it
        
    def register(self):                                                                     # function to register the hook, first
        self.newWndProc = WndProcType(self.MyWndProc)                                       # get the address of our wndproc
        self.oldWndProc = SetWindowLong(self.nppHandle, GWL_WNDPROC, self.newWndProc)       # register it and receive old wndproc address
        console.editor.setProperty('oldWndProc', self.oldWndProc)                           # store it to be able to unregister it needed
        
    def unregister(self):                                                                   # function to unregister hook
        self.prevWndProc = console.editor.getProperty('oldWndProc')                         # receive previously stored wndproc address
        dummy = SetWindowLong(self.nppHandle, GWL_WNDPROC, int(self.prevWndProc))           # register it - return isn't interesting 

    def MyWndProc(self, hWnd, msg, wParam, lParam):                                         # our own wndproc function receives windows messages
        if msg == WM_ACTIVATEAPP:                                                           # if it is WM_ACTIVATEAPP and 
            if wParam == False:                                                             # if wparam is false then npp has lost focus and
                self.saveFiles()                                                            # we can start saving the files

        return CallWindowProc(self.oldWndProc, hWnd, msg, wParam, lParam)                   # IMPORTANT we need to pass received msg to npp, otherwise npp will be blocked.

    def saveFiles(self):
        buf = notepad.getCurrentBufferID()                                                  # remember current document id
        
        for f in notepad.getFiles():                                                        # loop through all files and
            if os.path.isfile(f[0]):                                                        # check if file is real (no new X file)
                notepad.activateBufferID(f[1])                                              # if so, switch to the doc
                if notepad.getCurrentBufferID() == f[1]:                                    # and check if we have the focus we want (and ignore hidden files)
                    notepad.save()                                                          # now save it.
            else:                                                                           # here &lt;- looks like this is a new x file
                notepad.activateBufferID(f[1])                                              # switch to the doc
                if notepad.getCurrentBufferID() == f[1]:                                    # and check if we have the focus we want (and ignore hidden files)
                    notepad.saveAs(NewFileDir + f[0] + NewFileExt)                          # now save it as ...
        
        notepad.activateBufferID(buf)                                                       # switch back to initial doc
        
_hook = Hook()                                                                              # get a instance of our class

if console.editor.getProperty('Hookstatus') != '1':                                         # see if this call is used to register or unregister our wndproc
    console.editor.setProperty('Hookstatus', '1')                                           # it is the first call or call to register it again
    _hook.register()                                                                        # let's do it
else:                                                                                       
    console.editor.setProperty('Hookstatus', '0')                                           # we should unregister our hook
    _hook.unregister()                                                                      # so we do it.
</code></pre>
<p dir="auto">If something is unclear, let me know.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15238</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15238</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Fri, 08 Apr 2016 23:43:58 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Fri, 08 Apr 2016 10:51:00 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a></p>
<p dir="auto">Thanks for jumping in and maybe save me from a lot of headaches!<br />
I am using the Python Plugin anyway, so this could work.</p>
<p dir="auto">The basic functionality of saving all open files without a prompt would do.<br />
That means it has to overwrite existing files.</p>
<p dir="auto">There is the matter of new files, like new 1, new 2 and so forth. I use these a lot for temporary code and snippets for later use.<br />
I have set Autosave to save those to a configured  temp directory, using the name given when opening a new file. This also would overwrite existing files with the same name in that directory. Which I have no problem with as these are only session critical files for me.</p>
<p dir="auto">Cheers<br />
Martin</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15221</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15221</guid><dc:creator><![CDATA[decoderman]]></dc:creator><pubDate>Fri, 08 Apr 2016 10:51:00 GMT</pubDate></item><item><title><![CDATA[Reply to Autosave development request on Fri, 08 Apr 2016 01:04:07 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/decoderman" aria-label="Profile: decoderman">@<bdi>decoderman</bdi></a>,</p>
<p dir="auto">I never used autosave, so I don’t know its functionality.<br />
Saving if npp looses focus, is this the only feature you need?<br />
If so, do you care if this feature is called by a python script (python script plugin needs to be installed)?<br />
Need to check a few things but I assume it is possible to realize.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/15216</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/15216</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Fri, 08 Apr 2016 01:04:07 GMT</pubDate></item></channel></rss>