Community
    • Login

    Call Tip Color change

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    39 Posts 6 Posters 2.6k 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.
    • EkopalypseE
      Ekopalypse @Michael Vincent
      last edited by

      :-D - I have to admit it took me a while to find this in another thread too.
      Seems to be a hidden gem :-)

      Lycan ThropeL 1 Reply Last reply Reply Quote 2
      • Lycan ThropeL
        Lycan Thrope @Ekopalypse
        last edited by

        @ekopalypse ,

        Thanks for helping. Unfortunately, the only result that happened earlier with the old startup, is that when I tried the calltip, it wouldn’t show. I rebooted NPP, read your last messsage, did that, and now I have two scripts in the menu.
        PytonScriptResults.PNG

        Wish I’d seen your last tip sooner about how to edit it. :-). I had to go into the directory and get it prior to the post. I tried in Config to remove the extra from the menu, to no effect. It won’t let me remove it. Soo…I soldier on, will try a few more of your things and see what happens. :-(

        Lee

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

          @lycan-thrope

          You can call it startup.py because it automatically adds a [user] tag, but another name is just as good, but then you always have to start it manually. Only startup.py files are executed as soon as npp reports readiness to the plugin.
          Have you checked in the console whether an error is displayed?

          Lycan ThropeL 1 Reply Last reply Reply Quote 0
          • Lycan ThropeL
            Lycan Thrope @Ekopalypse
            last edited by

            @ekopalypse said in Call Tip Color change:

            Have you checked in the console whether an error is displayed?

            Yes I have, and unless it’s invisible, no error. :-)

            Here’s what I have, so we’re on the same page. I put the import in, you suggested, I have the section Nick Brown suggested and this is what I have in screenshot so you can see the file as is:
            PSScriptPerEko.PNG

            I can get a screenshot of the console, if need be, but here is the result in my files using the Calltip with the settings that Nick has supplied, which I presume to be black text on a mild yellow background, per the r,g,b numbers:
            PSNoChange.PNG

            As you can see, the default light gray on bright white.

            I have to figure I’ve done something wrong, but what, I have no idea and am all ears. :-)

            Lee

            EkopalypseE PeterJonesP 3 Replies Last reply Reply Quote 0
            • EkopalypseE
              Ekopalypse @Lycan Thrope
              last edited by

              @lycan-thrope

              and after you saved it you restarted Npp?

              Lycan ThropeL 1 Reply Last reply Reply Quote 0
              • EkopalypseE
                Ekopalypse @Lycan Thrope
                last edited by

                @lycan-thrope

                is that now a new startup.py located in the plugins\config\pythonscript\scripts directory or the original from plugins\pythonscript\scripts directory?

                1 Reply Last reply Reply Quote 0
                • Lycan ThropeL
                  Lycan Thrope @Ekopalypse
                  last edited by

                  @ekopalypse said in Call Tip Color change:

                  and after you saved it you restarted Npp?

                  Yes sir. After doing something like this, I usually reboot and restart in Admin mode in case I need to make changes and save the files. I just did it again, to be sure, and tried using the call tip again. I do have install on startup, so there should be no issue with it being loaded, as far as I can tell. Here’s a shot:
                  PSConsole.PNG

                  Lee

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

                    @lycan-thrope

                    Is LAZY or ATSTARTUP set in the config?

                    3ad8c16b-cce9-4adf-b8a6-26bf15aac1ff-image.png

                    Lycan ThropeL 1 Reply Last reply Reply Quote 0
                    • Lycan ThropeL
                      Lycan Thrope @Ekopalypse
                      last edited by

                      @ekopalypse said in Call Tip Color change:

                      Is LAZY or ATSTARTUP set in the config?

                      ATSTARTUP. Else the console wouldn’t be shown, right? Now if it’s not loading the startup.py, that could be a problem, but not sure how to tell. The console is coming up and my assumption is that the startup.py is also starting up. Would that be an accurate assumption?

                      Lee

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

                        @lycan-thrope

                        No, the console will(should) open always. Gimme a sec to test something.

                        Lycan ThropeL 1 Reply Last reply Reply Quote 0
                        • Lycan ThropeL
                          Lycan Thrope @Ekopalypse
                          last edited by

                          @ekopalypse ,
                          Ok. Here’s a screenshot of my config Machine view:

                          PytonScriptConfigView.PNG

                          I can do what ever you suggest, if I am setup right. That is the question we’re looking at. :-)

                          Lee

                          EkopalypseE 2 Replies Last reply Reply Quote 0
                          • EkopalypseE
                            Ekopalypse @Lycan Thrope
                            last edited by

                            @lycan-thrope

                            and in User Scripts there is nothing?

                            My fresh setup test

                            97733d5a-f4b6-456d-b555-8a7619f5e732-image.png

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

                              @lycan-thrope ,

                              I have no idea and am all ears.

                              One thing I do in my user startup.py (and could be done in the system startup.py as well) is to add console writes to the beginning and end of the script

                              example user startup.py

                              from Npp import *
                              import sys
                              
                              console.write("Start of user startup.py\n")
                              ...
                              ... other commands here
                              ...
                              console.write("END of user startup.py\n\n")
                              

                              If I see those two lines printed, then I know that the user startup.py actually ran; if they aren’t printed, then something went wrong.

                              …

                              While I was typing this, there were more exchanges.

                              I usually reboot and restart in Admin mode

                              Reboot is unecessary for Notepad++ and plugins. They will do the same thing after reboot as after a complete exit and restart.

                              Do you mean “Run as Admin”, or do you mean you log in as the Administrator user after your reboot? Because the Administrator user will have a different %AppData% than your normal user, so the user startup.py won’t be in the right place.

                              Also, you should really look at your Plugins > Python Script > Configuration like Eko showed:

                              If you have User Scripts selected and don’t see startup.py in the Scripts box (like Eko’s is empty), then you do not have any user scripts… which means, if you think you are editing the user startup.py like Eko suggested earlier, you are not. edit: if you’re intentionally just using system startup.py, that is of course your perogative.

                              At this point, showing us the screenshots of User Scripts and Machine Scripts, with startup.py visible in both (if they exist) would be great – oh, you’ve posted machine-scripts while I was writing this paragraph; along with the copy/paste of your current Debug Info , along with the exact location of the startup.py that you are editing.

                              Lycan ThropeL 2 Replies Last reply Reply Quote 2
                              • EkopalypseE
                                Ekopalypse @Lycan Thrope
                                last edited by

                                @lycan-thrope

                                c8469e54-3860-4fd6-a403-2e3ec5b0fdf5-image.png

                                1 Reply Last reply Reply Quote 1
                                • Lycan ThropeL
                                  Lycan Thrope @PeterJones
                                  last edited by

                                  @peterjones ,

                                  I “Run as Admin”, right click on starting NPP. I am in Admin mode, as far as I know, but still seem to have to open certain things “Run as Admin” when I want to save to admin only areas with applications. I could be wrong, however and it would be the first time. :-)

                                  First debug info:

                                  • Notepad++ v8.1.9.3 (64-bit)
                                  • Build time : Dec 6 2021 - 19:21:37
                                  • Path : C:\Program Files\Notepad++\notepad++.exe
                                  • Command Line :
                                  • Admin mode : ON
                                  • Local Conf mode : OFF
                                  • Cloud Config : OFF
                                  • OS Name : Windows 10 Home (64-bit)
                                  • OS Version : 2009
                                  • OS Build : 19043.1466
                                  • Current ANSI codepage : 1252
                                  • Plugins : ComparePlugin.dll mimeTools.dll NppConverter.dll NppExport.dll NppXmlTreeviewPlugin.dll PythonScript.dll XMLTools.dll

                                  This is the Config User Script section:
                                  PythonConfigUser.PNG

                                  And this is the file location on the Header bar showing the path to the current file:
                                  AdminNPPModeShot.PNG

                                  Lee

                                  1 Reply Last reply Reply Quote 0
                                  • Lycan ThropeL
                                    Lycan Thrope @PeterJones
                                    last edited by

                                    @peterjones ,

                                    Took your hint, Peter, added the two lines you suggested, in the “supposed” auto startup, and it’s not running as far as I can tell. Here’s the screenshot after changing and adding those lines to what I presume is the actual startup file, rebooted NPP, restarted “Run as administrator”, and this is the result:
                                    ANonrunningscript.PNG

                                    As you can see, no lines in the console.

                                    And the prior statement, though tongue in cheek, was a typo also, meaning, it’s not like I haven’t been wrong before so I may well be wrong this time, about being in the Admin mode running my system.

                                    Lee

                                    Lycan ThropeL Michael VincentM PeterJonesP 3 Replies Last reply Reply Quote 0
                                    • Lycan ThropeL
                                      Lycan Thrope @Lycan Thrope
                                      last edited by

                                      @lycan-thrope
                                      On the off chance I had the first line in the wrong place, I put it below the console redirection, saved, rebooted, restarted as admin and took this shot, still no response:
                                      ANonrunningscript2.PNG

                                      Lycan ThropeL 1 Reply Last reply Reply Quote 0
                                      • Lycan ThropeL
                                        Lycan Thrope @Lycan Thrope
                                        last edited by

                                        @lycan-thrope
                                        And just in case that asterisk was supposed to be put at the front of the import, I included that again and rebooted and ran, with the same result:

                                        ANonrunningscript3.PNG

                                        1 Reply Last reply Reply Quote 0
                                        • Michael VincentM
                                          Michael Vincent @Lycan Thrope
                                          last edited by Michael Vincent

                                          @lycan-thrope said in Call Tip Color change:

                                          Took your hint, Peter, added the two lines you suggested, in the “supposed” auto startup, and it’s not running as far as I can tell. Here’s the screenshot after changing and adding those lines to what I presume is the actual startup file, rebooted NPP, restarted “Run as administrator”, and this is the result:

                                          Not a Python expert, but surprised you’re not getting an error. You only import editor1 and editor2 from Npp, not console, but you proceed to call console. I checked, there doesn’t seem to be a console method in sys so not sure why you’re not seeing an error.

                                          Maybe your Npp import line should be :

                                          from Npp import console, editor1, editor2
                                          

                                          or better yet, since it’d be beneficial to import all Npp into your PythonScript console:

                                          from Npp import *
                                          
                                          • Did you try not running in Admin mode?
                                          • Did you try to use the user startup.py located in (assuming from your image):
                                            C:\Program Files\Notepad++\plugins\Config\PythonScript\scripts\startup.py

                                          Cheers.

                                          Lycan ThropeL 1 Reply Last reply Reply Quote 0
                                          • PeterJonesP
                                            PeterJones @Lycan Thrope
                                            last edited by

                                            @lycan-thrope

                                            So it’s obviously not running the startup.py that you are editing.

                                            When i run, I will see:
                                            8255846d-0c28-45e5-a89a-3babb4f0216d-image.png

                                            or
                                            c18414a7-6c86-4e2d-bb81-ec3021bded1d-image.png

                                            (so when I change the color and restart notepad++, it changes the color)

                                            Running in Admin mode is just asking for trouble. But I tried with my portable setup (the one I am showing), and it still ran my startup script

                                            I don’t know what you’ve corrupted, but you’ve done something tp mess it up so it’s not trying to run the startup.py … Please reset to the file below

                                            # The lines up to and including sys.stderr should always come first
                                            # Then any errors that occur later get reported to the console
                                            # If you'd prefer to report errors to a file, you can do that instead here.
                                            import sys
                                            from Npp import *
                                            console.write("START of machine startup.py\n\n")
                                            
                                            # Set the stderr to the normal console as early as possible, in case of early errors
                                            sys.stderr = console
                                            
                                            # Define a class for writing to the console in red
                                            class ConsoleError:
                                            	def __init__(self):
                                            		global console
                                            		self._console = console;
                                            
                                            	def write(self, text):
                                            		self._console.writeError(text);
                                            
                                            # Set the stderr to write errors in red
                                            sys.stderr = ConsoleError()
                                            
                                            # This imports the "normal" functions, including "help"
                                            import site
                                            
                                            sys.stdout = console
                                            
                                            # In order to set the stdout to the current active document, uncomment the following line
                                            # sys.stdout = editor
                                            # So print "hello world", will insert "hello world" at the current cursor position
                                            
                                            ########## added:
                                            for e in (editor1,editor2):
                                                e.callTipSetBack((255,255,176))
                                                e.callTipSetFore((127,0,0))
                                            
                                            console.write("END of machine startup.py\n\n")
                                            console.show()
                                            

                                            make sure it’s ATSTARTUP, exit Notepad+ and re-run. If it doesn’t open the console window and show your prints, then you do not have things set up the way you think you do, or you have corrupted some other file with all your messing about.

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