Problem running a macro without any associated key combination
-
I got the same message in NPP yesterday when I attempted to run an often-used Python script for which I’d created a key combo last year, and used without any issue until now. However, my getting that message was not preceded by any use of CCleaner, which I haven’t used in a long time, so that’s probably not related. My script lives, for key combo launching purposes, at menu
Plugins>Python Script>ADM, with an assigned key combo ofCtrl+Alt+Numpad1. You should post your debug info (menu?>Debug Info…) here. My own is:Notepad++ v8.9.7 (32-bit) Build time: Jul 14 2026 - 01:11:31 Scintilla/Lexilla included: 5.6.4/5.5.1 Boost Regex included: 1_90 pugixml included: 1.16 nlohmann JSON included: 3.12.0 Path: C:\Program Files (x86)\Notepad++\notepad++.exe Command Line: "C:\Program Files\ArdfryImaging\PNGOUTWin\PNGOUTWin Reg Codes.txt" Admin mode: OFF Local Conf mode: OFF Cloud Config: OFF WinGUp: present disableNppAutoUpdate.xml: absent Periodic Backup: ON Placeholders: OFF Scintilla Rendering Mode: SC_TECHNOLOGY_DIRECTWRITE (1) Multi-instance Mode: monoInst asNotepad: OFF File Status Auto-Detection: cdEnabledNew (for current file/tab only) Dark Mode: OFF Display Info: primary monitor: 1920x1080, scaling 100% visible monitors count: 1 installed Display Class adapters: 0000: Description - Intel(R) HD Graphics 620 0000: DriverVersion - 31.0.101.2140 0001: Description - NVIDIA GeForce 940MX 0001: DriverVersion - 30.0.15.1169 OS Name: Windows 10 Enterprise (64-bit) OS Version: 22H2 OS Build: 19045.7548 Current ANSI codepage: 1252 Plugins: BetterMultiSelection (1.5) ColumnsPlusPlus (1.3.1) ColumnTools (1.4.5.1) ComparePlus (3) DSpellCheck (1.5) ExtSettings (1.3.1) HTMLTag_unicode (1.6) mimeTools (3.1) MultiClipboard (2.1) MultiReplace (6.0.0.36) NppCalc (1.5) NppConverter (4.7) NppExport (0.4) NPPJSONViewer (2.2) NppTextFX (2.0.3) NppXmlTreeviewPlugin (2) PreviewHTML (1.4.5) PythonScript (2.1) RegexTrainer (1.2) Search++ (0.6) SessionMgr (1.4.4)Possible v8.9.7 bug?
-
Forgot to add: You can find
Validate shortcuts.xmlat menuRun>Validate shortcuts.xml. -
Forgot to add: You can find
Validate shortcuts.xmlat menuRun>Validate shortcuts.xml.Thank you very much. My problem is solved.
Paolo -
Possible v8.9.7 bug?
I wouldn’t call it a bug. v8.9.7 intentionally made sure that running a Macro performed the same HMAC check as running a Run menu entry. If your PythonScript runs a menu command (either a macro or a run-menu command, especially), it would also trigger that check. Or, if you hadn’t used any of the intervening v8.9.6.2-4 subversions, then your HMAC would never have been updated, and Notepad++ would demand a single validate to your custom shortcuts, becaus of your PythonScript shortcut.
-
[…] Notepad++ would demand a single validate to your custom shortcuts, because of your PythonScript shortcut.
I’m either missing something, or the shortcuts.xml security feature doesn’t work as described (or at least, as interpreted by me) here or in the user manual. I’ve had to re-do
Validate shortcuts.xmlhalf a dozen time since my previous post in this topic, but I haven’t made any changes to shortcuts.xml since then, nor changed the version of NPP used. It sounds to me like I should only be required to validate once, until/unless I make further changes to shortcuts.xml. Am I misinterpreting? -
Update: My having to repeatedly utilize
Validate shortcuts.xmlappears to be related to my common use of multiple instances of NPP. If I’ve used the shortcut for my PythonScript macro at least once during a session in one of my NPP instances, I have to re-validate the first time I try to use it in the other instance the next time I run NPP. I know this isn’t the official place for bug reports/feature or improvement requests, but is there any merit in my bringing it up? -
Update: My having to repeatedly utilize
Validate shortcuts.xmlappears to be related to my common use of multiple instances of NPP. If I’ve used the shortcut for my PythonScript macro at least once during a session in one of my NPP instances, I have to re-validate the first time I try to use it in the other instance the next time I run NPP. I know this isn’t the official place for bug reports/feature or improvement requests, but is there any merit in my bringing it up?What do you mean by mutliple instances? Do you mean, “I have mutiInstance mode on, and I am running the same
c:\program files\Notepad++\notepad++.exeexecutable multiple times”, or do you mean, “I have multiple portable editions of Notepad++, and if I run PythonScript fromc:\portable1\notepad++.exe, it will somehow causec:\portable2\notepad++.exeto need to re-validate.” ?Unfortunately, your description is too vague for me to understand exactly what you’re doing.
To be able to help you, I would need to understand exactly your sequence, and what’s going on. The best thing to do is find the smallest possible script for PythonScript that triggers this bug (that’s safe to share and run on someone else’s computer), and then give a detailed sequence of the settings and setup you are using, and the sequence of events that causes you to need to re-validate.
-
This post is deleted! -
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 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.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. Stay tuned. If it comes back, I’ll be sure to make a note of the exact sequence and post again.
-
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 doingnotepad++.exe -multiInst -nosessionvia 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 theconfig.xmlyet, so when the new instance readsconfig.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.exeto editconfig.xmland 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.xmlwith 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.xmlto 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 theshortcuts.xmlitself)
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.
- create
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login