Community
    • Login

    List of all assigned keyboard shortcuts

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    47 Posts 17 Posters 29.4k 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.
    • guy038G
      guy038
      last edited by

      Hi, Macgryver Johnson and Scott,

      I sent you my Synthesis.cpp file, few minutes ago, by e-mail to both of you

      Cheers

      guy038

      1 Reply Last reply Reply Quote 0
      • William RutkowskiW
        William Rutkowski
        last edited by

        https://drive.google.com/file/d/0B86nuTd5nMTKaENHcmliUC1kdnc/edit?usp=sharing

        This comes from the Notepad++ sites homepage. Scroll down to the bottom it is the last option. Hope it helps…Peace…

        1 Reply Last reply Reply Quote 1
        • IvyNoI
          IvyNo
          last edited by

          Hi,
          I know these posts are pretty old, but I hope I can still get the list.
          Would you please send it to my email ivy.noname@web.de
          Thanks a lot

          1 Reply Last reply Reply Quote 0
          • guy038G
            guy038
            last edited by

            Hello, @IvyNo,

            These next days, I’ll try to update the old list of Notepad++ and Scintilla commands, which I talk about in my first post of this thread, above. So, from the v7.2 version you’ll get the last v7.7 version of this file.

            Remember that this file is, simply, a personal synthesis of some data from the 3 files Parameters.cpp, keys.h and menuCmdID.h, normally located in folder notepad-plus-plus-7.7\PowerEditor\src of the archive notepad-plus-plus-7.7.zip

            So, please, let me a couple of days to get it right and I’ll send you this Synthesis.cpp file, as well as the default complete list of N++ v7.7 shortcuts, bye-mail ;-))

            Best Regards,

            guy038

            1 Reply Last reply Reply Quote 4
            • IvyNoI
              IvyNo
              last edited by

              Hi Guy038,
              Thanks a lot for your fast answer.
              There is no hurry, take your time, I am happy to get the list, no matter when :-)
              Kind regards

              1 Reply Last reply Reply Quote 0
              • guy038G
                guy038
                last edited by

                Hi, @IvyNo,

                Sorry for the long delay :-( First, I spent a week on vacation for a family celebration ( at the seaside !), then I helped a friend of my wife’s for computer problems and I had to prepare for my daughter’s future move, next Saturday ! And, of course, I delved into the source files of Notapad+++ 7.7.0 !

                I sent you a mail, some minutes ago, with 6 attached files :

                • Synthesis.cpp, which recapitulates all Notepad++ 7.7.0 internal commands and corresponding Scintilla messages

                • SCI_list.cpp, which contains all messages and values of the ...\Scintilla\include\Scintilla.h file

                • Shortcuts_list.cpp, which lists all default shortcuts of Notepad++ 7.7.0

                and, for information :

                • Define_list.cpp, which recapitulates all #define statements, referring to a numeric or string value, found in all the source files

                • Enum_List.cpp, which contains all enumerations from the ...\Scintilla\include\Scintilla.iface file

                • Keys_US.cpp, which lists all the scan codes of a traditional US keyboard

                Note :

                • These .cpp files could have been renamed as simple .txt files. But, by doing so, we just take advantage of the highlighting of numerical values and strings and of the folding, due to the pair { and } :-))

                I just hope that you’ll find useful some part of all that stuff, anyway !

                Best Regards,

                guy038

                1 Reply Last reply Reply Quote 3
                • Дмитрий РыжовД
                  Дмитрий Рыжов
                  last edited by

                  Hi @guy038
                  I have been looking for a similar table for a long time. Can I see the results of your labors? jang.spb@gmail.com

                  1 Reply Last reply Reply Quote 0
                  • EkopalypseE
                    Ekopalypse
                    last edited by

                    If I could iterate through it in a python code snippet would work

                    Just in case some else has the same requirement

                    import ctypes
                    import ctypes.wintypes as wintypes
                    
                    user32 = ctypes.WinDLL('user32', use_last_error=True)
                    
                    NPP_HANDLE = user32.FindWindowW(u'Notepad++', None)
                    
                    MIIM_SUBMENU = 4
                    MIIM_STRING = 64
                    
                    class MENUITEMINFO(ctypes.Structure):
                        _fields_ = [ ("cbSize"       , wintypes.UINT),
                                     ("fMask"        , wintypes.UINT),
                                     ("fType"        , wintypes.UINT),
                                     ("fState"       , wintypes.UINT),
                                     ("wID"          , wintypes.UINT),
                                     ("hSubMenu"     , wintypes.HMENU),
                                     ("hbmpChecked"  , wintypes.HBITMAP),
                                     ("hbmpUnchecked", wintypes.HBITMAP),
                                     ("dwItemData"   , wintypes.LPVOID),  # ULONG_PTR
                                     ("dwTypeData"   , wintypes.LPWSTR),
                                     ("cch"          , wintypes.UINT),
                                     ("hbmpItem"     , wintypes.HBITMAP),]
                    
                    npp_menu_handle = user32.GetMenu(NPP_HANDLE)
                    
                    def get_configured_shortcuts(menu_handle):
                        menu_items = user32.GetMenuItemCount(menu_handle)
                        for item in range(menu_items):
                            uitem = item
                            fByPosition = True
                            mii = MENUITEMINFO()
                            mii.cbSize = ctypes.sizeof(mii)
                            mii.fMask = MIIM_STRING | MIIM_SUBMENU
                            lpmii = ctypes.byref(mii)
                    
                            user32.GetMenuItemInfoW(menu_handle,
                                                    uitem,
                                                    fByPosition,
                                                    lpmii)
                    
                            if mii.hSubMenu:
                                get_configured_shortcuts(mii.hSubMenu)
                    
                            mii.dwTypeData = ctypes.cast(ctypes.create_unicode_buffer(mii.cch+1), ctypes.c_wchar_p)
                            mii.cch = mii.cch+1
                            mii.cbSize = ctypes.sizeof(mii)
                            user32.GetMenuItemInfoW(menu_handle,
                                                 uitem,
                                                 fByPosition,
                                                 lpmii)
                    
                            if '\t' in mii.dwTypeData:
                                shortcuts.append(mii.dwTypeData.split('\t'))
                    
                    
                    shortcuts = []
                    for i in range(user32.GetMenuItemCount(npp_menu_handle)):
                        submenu_handle = user32.GetSubMenu(npp_menu_handle, i)
                        get_configured_shortcuts(submenu_handle)
                    
                    _max_length = len(max([x[0] for x in shortcuts], key=len))
                    notepad.new()
                    editor.setText('\r\n'.join(['{0:<{2}} : {1}'.format(x[0], x[1], _max_length) for x in shortcuts]))
                    
                    Alan KilbornA 1 Reply Last reply Reply Quote 2
                    • Alan KilbornA
                      Alan Kilborn @Ekopalypse
                      last edited by

                      @Ekopalypse

                      Interesting approach to get some of the shortcuts. :)

                      EkopalypseE 1 Reply Last reply Reply Quote 0
                      • EkopalypseE
                        Ekopalypse @Alan Kilborn
                        last edited by

                        @Alan-Kilborn

                        Why some? What did I miss?

                        Alan KilbornA 1 Reply Last reply Reply Quote 0
                        • Alan KilbornA
                          Alan Kilborn @Ekopalypse
                          last edited by

                          @Ekopalypse

                          Well, just as one example, most (if not all) Scintilla commands that have shortcuts in Shortcut Mapper are not output by the script.

                          EkopalypseE 1 Reply Last reply Reply Quote 2
                          • EkopalypseE
                            Ekopalypse @Alan Kilborn
                            last edited by Ekopalypse

                            @Alan-Kilborn

                            You are right, how could I miss those?
                            Damn it.

                            Alan KilbornA 1 Reply Last reply Reply Quote 1
                            • Alan KilbornA
                              Alan Kilborn @Ekopalypse
                              last edited by

                              @Ekopalypse

                              I have seen this thread before, but didn’t have any new ideas about it. When I saw your recent efforts, I thought it was interesting as I hadn’t thought about that kind of approach. So now I’m thinking, if the Shortcut Mapper info is left in memory (after being invoked once?), could some ctypes magic find it and report it? I don’t know enough about the internals, IIRC doesn’t it use something called BabyGrid or something like that?

                              EkopalypseE 2 Replies Last reply Reply Quote 2
                              • EkopalypseE
                                Ekopalypse @Alan Kilborn
                                last edited by

                                @Alan-Kilborn

                                if the Shortcut Mapper info is left in memory (after being invoked once?), could some ctypes magic find it and report it

                                Not sure about it, digging in npps memory seems to be a dangerous place :-D

                                1 Reply Last reply Reply Quote 1
                                • Alan KilbornA
                                  Alan Kilborn
                                  last edited by

                                  Maybe it would be best if N++ itself had a feature to export this infos. :P

                                  EkopalypseE 1 Reply Last reply Reply Quote 1
                                  • EkopalypseE
                                    Ekopalypse @Alan Kilborn
                                    last edited by Ekopalypse

                                    @Alan-Kilborn

                                    the shortcut mapper dialog seems to be the trusted source in this situation, isn’t it?
                                    As it is a blocking dialog we start it in a different thread and then searching for the tabsyscontrol
                                    and then with some magic ctypes we should be able to get the shortcuts currently configured.
                                    Hmm, fun project - I guess I’ll give it a try :-)

                                    1 Reply Last reply Reply Quote 2
                                    • EkopalypseE
                                      Ekopalypse @Alan Kilborn
                                      last edited by

                                      @Alan-Kilborn

                                      unfortunately TCM_SETCURSEL doesn’t trigger babygrid to be updated therefore I had to use keybd_event but seems to work.

                                      import ctypes
                                      import ctypes.wintypes as wintypes
                                      from threading import Thread
                                      import time
                                      
                                      user32 = ctypes.WinDLL('user32', use_last_error=True)
                                      
                                      def start_sk_dialog():
                                          notepad.menuCommand(MENUCOMMAND.SETTING_SHORTCUT_MAPPER)
                                      
                                      
                                      sk_mapper = Thread(target=start_sk_dialog)
                                      sk_mapper.start()
                                      time.sleep(1)
                                      
                                      WM_USER = 1024
                                      WM_CLOSE = 16
                                      
                                      TCM_FIRST = 4864
                                      TCM_GETITEMCOUNT = (TCM_FIRST + 4)
                                      TCM_SETCURSEL = (TCM_FIRST + 12)
                                      
                                      BABYGRID_USER = (WM_USER + 7000)
                                      BGM_GETCELLDATA  = BABYGRID_USER + 4
                                      BGM_GETROWS  = BABYGRID_USER + 23
                                      
                                      class BGCELL(ctypes.Structure):
                                          _fields_ = [('row', wintypes.INT),
                                                      ('col', wintypes.INT)]
                                      
                                      cell_buffer = ctypes.create_unicode_buffer(1000)
                                      
                                      bgcell = BGCELL()
                                      
                                      sk_mapper_hwnd = user32.FindWindowW(None, u'Shortcut mapper')
                                      sys_tab_hwnd = user32.FindWindowExW(sk_mapper_hwnd, None, u'SysTabControl32',None)
                                      item_count = user32.SendMessageW(sys_tab_hwnd, TCM_GETITEMCOUNT, 0, 0)
                                      babygrid = user32.FindWindowExW(sk_mapper_hwnd, None, u'BABYGRID',None)
                                      
                                      shortcuts = []
                                      for tab in range(item_count):
                                          rows = user32.SendMessageW(babygrid, BGM_GETROWS, 0, 0)
                                          print 'rows', rows
                                      
                                          for i in range(1, rows+1):
                                              shortcut = []
                                              for j in range(1,3):
                                                  bgcell.row = i
                                                  bgcell.col = j
                                                  res = user32.SendMessageW(babygrid,
                                                                    BGM_GETCELLDATA,
                                                                    ctypes.byref(bgcell),
                                                                    cell_buffer)
                                                  shortcut.append(cell_buffer.value)
                                              shortcuts.append(shortcut)
                                      
                                          user32.SetForegroundWindow(sk_mapper_hwnd)
                                          user32.SendMessageW(sys_tab_hwnd, TCM_SETCURSEL, tab, 0)
                                          user32.keybd_event(0x27,0,0,0)
                                          user32.keybd_event(0x27,0,2,0)
                                      
                                      user32.SendMessageW(sk_mapper_hwnd, WM_CLOSE, 0, 0)
                                      
                                      _max_length = len(max([x[0] for x in shortcuts if x[1]], key=len))
                                      notepad.new()
                                      editor.setText('\r\n'.join(['{0:<{2}} : {1}'.format(x[0], x[1], _max_length) for x in shortcuts if x[1]]))
                                      
                                      Alan KilbornA 1 Reply Last reply Reply Quote 2
                                      • Alan KilbornA
                                        Alan Kilborn @Ekopalypse
                                        last edited by

                                        @Ekopalypse

                                        Hmmm, poking around this a little bit…

                                        I get zero returned from the FindWindowW call, even though the window is opened by the script. Looking closer, I see in the call it is looking for Shortcut mapper but my window title is Shortcut Mapper. But changing the script to have a capital M makes no difference; zero still returned…

                                        EkopalypseE 2 Replies Last reply Reply Quote 1
                                        • EkopalypseE
                                          Ekopalypse @Alan Kilborn
                                          last edited by

                                          @Alan-Kilborn

                                          strange, which npp version do you use?

                                          1 Reply Last reply Reply Quote 0
                                          • EkopalypseE
                                            Ekopalypse @Alan Kilborn
                                            last edited by

                                            @Alan-Kilborn

                                            I tried it with 7.6.6(64bit) and 7.7.1(32bit).
                                            And title is on both Shortcut mapper

                                            Alan KilbornA 1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors