I already made my debug info available in my first post in this topic, which clearly indicated that I’m using an installed x86 version of NPP.
I am sorry I didn’t remember that from a week ago.
And “multiple instances” can have different meanings to different people. Even if I had remembered you were using installed, that doesn’t mean that you weren’t also using a portable: not everyone would think to mention such a thing – they might not even think about it, when using their multiple installations/portables next to each other. (I have my daily as Installed, but I also have multiple active portables that use different configurations). I just needed to make sure, because different setups could have vastly different reasons for the symptoms you describe.
I normally run NPP the first time after a restart via either its shortcut in my taskbar or the start menu. Any second instance is normally opened with command line options -multiInst -nosession (via AutoHotkey keyboard shortcut), and I always exit it before exiting the primary instance.
In theory then, the validate from the main instance should get saved. After you validated, did you exit before running again and spawning multiple instances? Because Notepad++ doesn’t save the new copy of the config file (with the new validation HMAC code) until it exits. So if you ran the main, ran validate, then spawned new instances, the HMAC code might not have propagated to the new instances
I don’t know whether N++ gives a copy of the current config structure from memory to the new process, or whether the new process is completely separate, in which case, it would have read the old version from the disk again – re-reading, since you are doing notepad++.exe -multiInst -nosession via AHK (ie, outside N++, instead of using the “Clone to New Instance” command from inside Notepad++), it would have no way of propagating that HMAC to the new instance, because it hasn’t written it to the config.xml yet, so when the new instance reads config.xml, it is out-of-date.
A few hours ago, just before I posted my last reply, I was consistently able to replicate NPP’s demand that I re-validate when trying to run my macro. Now, I can’t. No idea why.
I am wondering if you finally had a sequence where you did the validate, then exited so it saved the right HMAC, and now everything is settled. I hope so (and believe so).
Stay tuned. If it comes back, I’ll be sure to make a note of the exact sequence and post again.
Based on my experiments (below), which are 100% repeatable for me, now that the HMAC has been properly saved, it shouldn’t prompt you again until you manually edit the shortcuts file.
My Steps to Confirm:
create example.pyfrom Npp import notepad
notepad.runMenuCommand("Macro", "Trim Trailing Space and Save")
exit all Notepad++
use notepad.exe to edit config.xml and remove the line with name=“shortcutsXmlHMAC” (which causes it to be not-yet-validated), and save
launch main copy of Notepad++
Run > validate shortcuts.xml
open a new instance of N++ with -multiInst -nosession
Plugins > PythonScript > scripts > example
→ it will pop up the shortcuts.xml file and the validation warning messagebox
please note: this doesn’t require you to use the keyboard shortcut; just that you run a scrpt that tries to run a macro or run-menu command, as far as I can tell – my experiments have not been using an assigned keystroke to run the script.
exit the second instance
exit the first instance (which should save the config.xml with validated HMAC)
launch main copy of Notepad++
open a new instance of N++ with -multiInst -nosession
Plugins > PythonScript > scripts > example
→ it will not pop up the shortcuts.xml file or the validation warning messagebox, because it’s valid
So, I guess the clarified version: if you are using multiple instances, close all intstances but one, look at shortcuts.xml to make sure all the macros and run-menu commands are as you expect them to be, then Run > validate shortcuts.xml, then exit Notepad++ to get it to save that. From now on, you shouldn’t need to validate again unless you intentionally manually edit shortcuts.xml. (Using Shortcut Mapper or saving new macros or run menu commands should not trigger a re-validate, because Notepad++ should update the HMAC when it changes the shortcuts.xml itself)
update: PR 889 is adding a NOTE to that effect in the shortcuts.xml security section – you may have to refresh your browser to see it.