Community
    • Login

    NumLock switched off when launching Notepad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Theo FondseT
      Theo Fondse
      last edited by

      Every time I launch Notepad++ on my Windows 10 laptop, NumLock is Switched OFF.
      I have used the Computer\HKEY_USERS.DEFAULT\Control Panel\Keyboard\InitialKeyboardIndicators=2 registry hack to switch Numlock ON when the machine boots, and it will stay on only until the point where I start Notepad++.
      This is driving me up the walls!
      Is there a way to prevent the NumLock from getting set to OFF when launching Notepad++?

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner @Theo Fondse
        last edited by

        @Theo-Fondse

        There is probably a better solution, but until you find it you could script turning Num Lock back on after Notepad++ starts up with the Pythonscript plugin.

        Put the following code in startup.py and make sure Pythonscript’s “Initialisation” option is set to ATSTARTUP (under the Configuration menu option for the Pythonscript plugin). Note that Pythonscript is only 32-bit right now, so it will only work with 32-bit Notepad++.

        I really hope you find a better solution and don’t have to resort to this !! :-D

        If this (or ANY posting on the Notepad++ Community site) is useful, don’t reply with a “thanks”, simply up-vote ( click the ^ in the ^ 0 v area on the right ).

        import ctypes
        
        def turn_on_numlock():
            VK_NUMLOCK = 0x90
            KEYEVENTF_EXTENDEDKEY = 0x01
            KEYEVENTF_KEYUP = 0x02
            GetKeyState = ctypes.windll.user32.GetKeyState
            keybd_event = ctypes.windll.user32.keybd_event
            if not GetKeyState(VK_NUMLOCK):
                keybd_event(VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0)
                keybd_event(VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0)
        
        turn_on_numlock()
        
        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors