There are two strongly related question in the SE network, which are slightly outdated:
- is there an autosave function/plugin for notepad++?is there an autosave function/plugin for notepad++? from StackOverflow SE
- Any way to have Notepad++ automatically save on exit from SuperUser SE
These answers lists two autosave plugins (which are easily found in Notepad++ Plugin Central):
- Autosave2 by www.scout-soft.com — Autosaves by creating a copy of the file at given time interval. In this particular context not so useful
- Autosave by Franco Stellari — Option available to configure autosave on timed intervals or when notepad++ looses focus
Picture displaying the new option dialog window (from version v1.20 2010-07-16) regarding autosave on loss of focus (see first option):
This new functionality of Autosave by Franco Stellari regarding autosave on loss of focus, should handle your usercase just fine.