Community
    • Login

    Change color of text after the echo in batch

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    13 Posts 3 Posters 1.3k 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.
    • amymorA
      amymor
      last edited by

      I know I can use REM or :: to comment but comments are not visible during batch execution. I want to use echo for commenting as well as printing. Is there a way to specify a custom color for a line that starts with echo?

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

        @amymor

        I had some luck using the EnhanceAnyLexer plugin.

        Have a batch file be the active file in Notepad++ and then invoke the plugin’s menu option Enhance Current Language. An .ini file for the plugin will be opened in Notepad++ and some options specific to a batch file will be added to it. You can then configure it like this:

        cefcf92b-f197-4e65-8f72-99573339fb43-image.png

        Note that I didn’t show the entire “excluded_styles” line because I didn’t change that line anyway.

        Here was the effect in a batch file:

        b8d18bc9-89b1-4595-a38c-177c66d2bf5f-image.png

        amymorA 1 Reply Last reply Reply Quote 2
        • amymorA
          amymor @Alan Kilborn
          last edited by

          @Alan-Kilborn After installing the EnhanceAnyLexer plugin, npp won’t open. Is there a another way to do it?

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

            @amymor

            There’s often more than one way to do things. But EnhanceAnyLexer is arguably the easiest solution to your problem.

            If I were you, I’d attack the “npp won’t open” problem.
            Without more info from you about that, though, we can’t offer up much help.

            amymorA 1 Reply Last reply Reply Quote 0
            • amymorA
              amymor @Alan Kilborn
              last edited by

              @Alan-Kilborn I don’t know more because it doesn’t give me any error

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

                @amymor

                Suggest: Remove the plugin by renaming its DLL file to a new name (any name will suffice). Attempt starting of Notepad++. Does it start?

                amymorA 1 Reply Last reply Reply Quote 0
                • amymorA
                  amymor @Alan Kilborn
                  last edited by

                  @Alan-Kilborn yes

                  Alan KilbornA 1 Reply Last reply Reply Quote 0
                  • amymorA
                    amymor
                    last edited by amymor

                    I tried an old version of it (version 0.1.0 first beta) and then it worked

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

                      @amymor

                      OK, well that certainly points to a definite problem. In my experience the plugin works fine. Perhaps the plugin’s author @Ekopalypse who is active here, can assist.

                      1 Reply Last reply Reply Quote 1
                      • amymorA
                        amymor
                        last edited by amymor

                        I noticed that the last two versions of it don’t work for me, but the v.0.5.0 beta and previous versions work.
                        Npp 8.4.2.0 x64

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

                          @amymor said in Change color of text after the echo in batch:

                          Npp 8.4.2.0 x64

                          Ah, OK, v1.01 of EnhanceAnyLexer also causes N++ 8.4.2 to not start up when I tried it as a test. N++ 8.4.3 and 8.4.4 start up fine with it.

                          The reason for the problems may be changes with the interface. Obviously N++ and plugins have to cooperate, and if N++ undergoes a change in core logic that make plugins incompatible, plugins have to evolve.

                          I suppose your options are to continue with the EAL 0.5.0 beta or update your N++ and use the newer EAL, if you want to continue with this.

                          amymorA 1 Reply Last reply Reply Quote 1
                          • amymorA
                            amymor @Alan Kilborn
                            last edited by

                            @Alan-Kilborn Thanks for your response, I will update the npp.

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

                              @amymor @Alan-Kilborn

                              I suppose that I have found the cause of the problem
                              It looks like calling NPPM_GETLANGUAGENAME with a value of -1 can cause npp to crash. I assume this also applies to NPPM_GETLANGUAGEDESC, as I suspect the problem manifests itself when getLangDesc is called.

                              Thread 1 received signal SIGSEGV, Segmentation fault.
                              0x00007ff6413bc493 in notepad++!GetNameSpace ()
                              (gdb) bt
                              #0  0x00007ff6413bc493 in notepad++!GetNameSpace ()
                              #1  0x00007ff6413d8f2d in notepad++!GetNameSpace ()
                              #2  0x00007ff6413dab12 in notepad++!GetNameSpace ()
                              #3  0x00007ff6413d4ce1 in notepad++!GetNameSpace ()
                              #4  0x00007ffd14c0e858 in USER32!CallWindowProcW () from C:\WINDOWS\System32\user32.dll
                              #5  0x00007ffd14c0e3dc in USER32!DispatchMessageW () from C:\WINDOWS\System32\user32.dll
                              #6  0x00007ffd14c20bc3 in USER32!SendMessageTimeoutW () from C:\WINDOWS\System32\user32.dll
                              #7  0x00007ffd16ed0d74 in ntdll!KiUserCallbackDispatcher () from C:\WINDOWS\SYSTEM32\ntdll.dll
                              #8  0x00007ffd14251124 in win32u!NtUserMessageCall () from C:\WINDOWS\System32\win32u.dll
                              #9  0x00007ffd14c0df02 in USER32!SendMessageW () from C:\WINDOWS\System32\user32.dll
                              #10 0x00007ffd14c0d68a in USER32!SendMessageW () from C:\WINDOWS\System32\user32.dll
                              #11 0x00007ffce3751888 in notepadpp__Npp_call (n=..., msg=2107, wparam=18446744073709551615, lparam=0)
                              

                              I add a check in EnhanceAnyLexer to prevent calling it in this case

                              pub fn(n Npp) get_language_name(buffer_id usize) string {
                              	lang_type := n.call(nppm_getbufferlangtype, buffer_id, isize(0))
                              	if lang_type == -1 {
                              		return 'UNKNOWN_ERROR'
                              	}
                              	mut buffer_size := int(n.call(nppm_getlanguagename, usize(lang_type), isize(0))) + 1
                              	mut buffer := alloc_wide(buffer_size)
                              
                              	n.call(nppm_getlanguagename, usize(lang_type), isize(buffer))
                              	lang_name := unsafe { string_from_wide(buffer) }
                              	return lang_name.to_lower().replace('udf - ', '')
                              }
                              

                              An issue has been opened.

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