Community
    • Login

    Custom Toolbar Icon - Custom Date Time Stamp: Mini-Tutorial

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 4 Posters 812 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.
    • glimmerwellG
      glimmerwell
      last edited by

      Hi all!

      I have been trying to create a toolbar icon to create a Custom Date Time Stamp in Notepad++. Searching the Internet suggests I am not the only one. I have finally succeeded and wanted to share it with the community. I am a relative newbie with NP++, but this was not hard.

      This will create a toolbar icon that when you click it, it will insert a timestamp with date and time into your document at your cursor position. It is the exact same thing as if you just go to:

      Edit dropdown menu > Insert > Date Time (customized)

      Here we go:

      1. Basically, you need to install the “Customized Toolbar” plugin. Go to:
        Plugins dropdown > Plugins Admin… and find and install that plugin.

      2. Then go to Plugins dropdown again > Customized Toolbar > Custom Buttons

      3. Reboot Notepad++

      4. Go to <username>\AppData\Roaming\Notepad++\plugins\config

      5. Open the new file that should be there called “CustomizeToolbar.btn” in Notepad++

      6. Add this text to the bottom of that file:

      ;Custom Toolbar Icon - Custom Date Time Stamp
      Edit,Insert,Date Time (customized),*B:T,*B:T,

      1. Save the file and reboot Notepad++.

      2. You should also configure the “Customize insert Date Time” to the way you want. It’s in Settings > Preferences > Multi-Instance & Date

      That’s it! You should now have new toolbar icon that is blue with a white ‘T’ for “Timestamp”.

      While this is good enough for me, I would like to replace the blue/white letter icon with a little clock icon like the one in CherryTree. If anyone can link me one that works I would appreciate it.

      Hope this is helpful to others! Let me know if I left something out; I went from memory. Thanks for this incredible editor that has meant so much to so many for so long!

      PeterJonesP 2 Replies Last reply Reply Quote 2
      • PeterJonesP
        PeterJones @glimmerwell
        last edited by

        @glimmerwell said in Custom Toolbar Icon - Custom Date Time Stamp: Mini-Tutorial:

        I would like to replace the blue/white letter icon with a little clock icon like the one in CherryTree. If anyone can link me one that works I would appreciate it.

        I don’t know what the “CherryTree” clock looks like. If you have an appropriate tool, you might be able to extract a clock icon from ...\windows\system32\shell32.dll or similar (or even from CherryTree itself). Once you have the 32x32 icon and/or 16x16 icon, then you can point CustomizeToolbar.btn config file to the icon instead of the quick-code which you currently use.

        glimmerwellG 1 Reply Last reply Reply Quote 2
        • glimmerwellG
          glimmerwell @PeterJones
          last edited by

          @PeterJones

          Thanks for replying!

          I tried what you said. I got a clock icon from shell32.dll. I had trouble getting it to save as a 32x32 32 bit-depth .ico, but I think I was finally able to do that.

          Unfortunately, I was unable to get the icon to work. The best I could do was get the “question mark” icon to appear. That still worked for the timestamp, but I went back for now to my blue and white T.

          Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 1
          • Alan KilbornA
            Alan Kilborn @glimmerwell
            last edited by

            @glimmerwell

            FWIW, I too have had trouble getting Customize Toolbar plugin to work, in a lot of ways. I still use it, because there is no good alternative, but I only use it in the simplest way possible, because I got tired of fiddling around with it.

            1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @glimmerwell
              last edited by

              @glimmerwell ,

              Like @Alan-Kilborn , I do occasionally have trouble getting a new icon to work right with Customize Toolbar. but I do have examples of icons with embedded 16x16x24bit and 32x32x24bit icons in the same .ico file, and it works as expected. I also have an icon that I extracted from charmap.exe that has a whole bunch of resolutions (a wide range from 16x16x4bit to 256x256x32bit) and it works, too. I seem to remember that the problem came when I only had 32bit icons in the .ico file: I think maybe it doesn’t do transparency quite right; but it’s been a few months (maybe a year) since I last experimented, so I forget all the details. So you might try adding 24bit versions to the .ico file (or replacing the 32bit versions with 24bit versions) and see what happens.

              glimmerwellG 1 Reply Last reply Reply Quote 1
              • glimmerwellG
                glimmerwell @PeterJones
                last edited by

                @PeterJones @Alan-Kilborn

                Thank you so much for helping!

                Icons are apparently not one of my areas of luck or skill! I have spent some more time on this seemingly simple task, but without success. I think we just need the right icon. Usually programs use a clock icon for timestamp. We need either:

                1. a .bmp with 16x16 pixels and bit depth of 8-bits
                  or
                2. an .ico of 32x32 pixels with a bit depth of 32-bits (RGB+alpha)

                I am using the Standard Icons: Small toolbar, so I am not sure if I have to use the .bmp format or not.

                For now, I will make do with my “T for Timestamp” until hopefully someone else comes along with a working icon!

                Thanks again!

                tseGITT 1 Reply Last reply Reply Quote 0
                • tseGITT
                  tseGIT @glimmerwell
                  last edited by

                  @glimmerwell I always work with BMP 16x16x24 and it’s fine.

                  1 Reply Last reply Reply Quote 1
                  • PeterJonesP
                    PeterJones @glimmerwell
                    last edited by PeterJones

                    @glimmerwell said in Custom Toolbar Icon - Custom Date Time Stamp: Mini-Tutorial:

                    ;Custom Toolbar Icon - Custom Date Time Stamp
                    Edit,Insert,Date Time (customized),*B:T,*B:T,
                    

                    The fields in CustomizeToolbar.btn are, as the Plugins > Customize Toolbar > Help-CustomButtons puts it,

                    f6e86360-24d4-4ab2-be8b-a6dd0d41a531-image.png

                    Interpreting that, the fields are:

                    Main Menu,Menu2,Menu3,Menu4,BMP-for-StandardIcons,ICO-for-fluent,ICO-for-DarkFluent
                    

                    You have a color code in the Menu4 slot, which is obviously not going to work.

                    I yanked icon #16771 out of shell32.dll and saved it to an ICO file that has 256x256 PNG, 64x64x32bit, 48x48x32bit, 40x40x32bit, 32x32x32bit, 24x24x32bit, 20x20x32bit, 16x16x32bit, and it works for me.

                    (I would upload the image, but since it’s extracted from shell32.dll, the copyright is owned by Microsoft)

                    I am using the Standard Icons: Small toolbar, so I am not sure if I have to use the .bmp format or not.

                    Yes, you do have to use the .bmp format (or the quick code in the .bmp slot) if you are on Standard Icons. That’s why the CustomizeToolbar help says “an optional .bmp file name for Standard icons”.

                    The syntax I used, since I don’t have a .bmp file to go with it, is

                    Edit,Insert,Date Time (customized),,*B:T,Icons\clock16771.ico,Icons\clock16771.ico
                    

                    Note that the first three fields are the menu names; the fourth field must be empty because there isn’t a fourth menu name, the fifth is a quick-code to be used instead of the .bmp, and the sixth and seventh are the icon files I extracted.

                    With this setup, if I’m in standard icons, it shows the [T], and if I’m in Fluent Icons, it uses the clock icon I extracted.

                    glimmerwellG 1 Reply Last reply Reply Quote 1
                    • glimmerwellG
                      glimmerwell @PeterJones
                      last edited by glimmerwell

                      @PeterJones said in Custom Toolbar Icon - Custom Date Time Stamp: Mini-Tutorial:

                      You have a color code in the Menu4 slot, which is obviously not going to work.

                      PeterJones, thanks for catching that!

                      That is strange. When I posted the original mini-tutorial I just copied and pasted from my own CustomizeToolbar.btn file, and in that file I have the correct number of commas. For some reason one of the commas disappeared in the first post here, but the number is still correct in my own CustomizeToolbar.btn file. Of course I can’t edit it now due to the restrictive editing time limit in this forum.

                      If anyone is still reading, here is the correct text to put in the CustomizeToolbar.btn file if you are satisfied with the “blue square with white T” icon. It works with both Standard and Fluent icon sets. However; it won’t give the nice icon in Fluent like in PeterJones’s helpful example:

                      ;Custom Toolbar Icon - Custom Date Time Stamp
                      Edit,Insert,Date Time (customized),,*B:T,*B:T,
                      

                      Maybe someone will link a .bmp icon for us Standard icon users.

                      Again, thanks for the help everyone!

                      Edit1 (just in time): For some reason when I post, the second comma is removed. There should be two commas, not one, after “Edit,Insert,Date Time (customized)”.

                      Edit2: Oh, you have to post the text using the grey code box to protect it. Good to know!

                      PeterJonesP 1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @glimmerwell
                        last edited by

                        @glimmerwell said in Custom Toolbar Icon - Custom Date Time Stamp: Mini-Tutorial:

                        Maybe someone will link a .bmp icon for us Standard icon users.

                        You claimed you could extract from shell32.dll. Just use that icon. I’ll be more explicit this time, because you may not have noticed my hover text, but using IconViewer tool (not affiliated with or endorsed by Notepad++; just something I personally use) to extract the icon #16771 out of shell32.dll, and using that extracted icon, works for me in fluent.

                        glimmerwellG 1 Reply Last reply Reply Quote 0
                        • glimmerwellG
                          glimmerwell @PeterJones
                          last edited by

                          @PeterJones

                          Yes, thank you, and I should have been more explicit, too. I did see the hover text and I installed IconViewer (neat tool, BTW. Thanks!). That is how I extracted the icon. But I am not using the Fluent toolbar. I just personally like the standard icons better.

                          I tried your code example from above:

                          Edit,Insert,Date Time (customized),,*B:T,Icons\clock16771.ico,Icons\clock16771.ico
                          

                          It only worked when I deleted the

                          Icons\
                          

                          parts. I am able to use the shell32.dll icon (that was the same clock icon I chose, as well) when I am in Fluent, but not in Standard. I even tried saving the shell32.dll icon image as a .bmp, but it did not work, probably because it is the wrong pixel/bit depth.

                          So here is what I have:

                          ;Custom Toolbar Icon - Custom Date Time Stamp
                          Edit,Insert,Date Time (customized),,*B:T,clock_icon.ico,clock_icon.ico
                          

                          That gives me: in Standard = the blue and white T, and in Fluent, both Light and Dark mode = the nice clock icon from shell32.dll.

                          But since I am using Standard icons, I still would like a bitmap version of the clock icon in 16x16 pixels and bit depth of 8-bits. It will have to be found, modified, or created. There are many icon packs out there, but this format seems harder to find. Though again, I clearly have little experience in icons.

                          Again, I am extremely grateful for all the assistance in this interesting puzzle!

                          Edit: For clarity, I can confirm for any readers that simply putting the .ico file name in the bitmap slot in the code does not work when you are using standard icons.

                          PeterJonesP 1 Reply Last reply Reply Quote 0
                          • PeterJonesP
                            PeterJones @glimmerwell
                            last edited by

                            @glimmerwell said in Custom Toolbar Icon - Custom Date Time Stamp: Mini-Tutorial:

                            That is how I extracted the icon. But I am not using the Fluent toolbar. I just personally like the standard icons better.

                            Then you have to use a bitmap.

                            I still would like a bitmap version of the clock icon

                            Microsoft Windows still comes with an application called mspaint.exe, even though it’s not their default for image editing anymore. You can open that application (WindowsKey + R => mspaint.exe, et voila, it appears), load the .ico file, and Save As a .bmp. Or you can find one of a plethora of app-based or online-based image converters which could convert the icon from .ico to .bmp for you.

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