Community
    • Login

    UDL: /* block comment in one line, error */

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    33 Posts 4 Posters 6.5k 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.
    • Eko palypseE
      Eko palypse @Meta Chuh
      last edited by

      @Meta-Chuh said:

      self.lexer_name = ‘udf - DSM4COM’

      this would only be returned when using notepad.getLanguageName(notepad.getLangType()) but
      the script uses windows/notepad API functions which means it should return something
      like User Defined language file - DSM4COM
      I guess you’ve already saw it but there is a little bug in the style function, as described here.

      Meta ChuhM 1 Reply Last reply Reply Quote 3
      • Meta ChuhM
        Meta Chuh moderator @Eko palypse
        last edited by Meta Chuh

        @Eko-palypse

        thanks, i’m not very experienced in python and the pythonscript plugin, but after your modified suffix script, i thought i give it a try and do the same for this older, unsolved thread.

        now that you are here, i have two more questions that you might be able to answer:

        why is it called udf - MyUDL if we use notepad.getLanguageName(), and not udl - MyUDL ?

        how do you kill a running pythonscript without restarting notepad++ ?

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

          1. Because. My guess is that at one point, it was “user defined format” or something similar in someone’s mind.
          2. Plugins > PythonScript > Stop Script
          Meta ChuhM 1 Reply Last reply Reply Quote 3
          • Meta ChuhM
            Meta Chuh moderator @PeterJones
            last edited by Meta Chuh

            thanks @PeterJones

            1. at first i thought UDF was a typo while coding, but the keys L and F are too far apart for that, unless it happened when hitting the D at the edge to F, triggering both, resulting in UDFL, followed by backspacing the L instead of deleting the F.

            2. this just stops a sequentially running script, but not event handlers or callbacks like this EnhanceUDLLexer.
              is it impossible to stop those without exiting notepad++, as this event handler kind of just passes all its specs to scintilla, which processes the rest, without any further involvement of pythonscript ?

            Eko palypseE 1 Reply Last reply Reply Quote 3
            • Eko palypseE
              Eko palypse @Meta Chuh
              last edited by

              @Meta-Chuh said:

              1. Notepad++ internals see here
              2. High level view
                Here we have to define what a running script means.
                PS is a kind of python REPL like the standard python shell
                which runs when you start python on the commandline.
                The difference is that every script starts in a separate thread,
                but those will, if no endless loop is written, end, normally, shortly after the start.
                Callbacks are responsible that it looks like the script is still running.
                The reason is that PS (python) remembers that there are objects (callbacks) that can not yet be destroyed
                and therefore continue to live in this REPL and then be accessed by PS if necessary.
                So to “end” this script, which is already finished, completely, it is needed
                to terminate the callbacks, which means to destory its references to these objects.
                This will be done with editor/notepad.clearCallbacks methods.
                The topic is of course a lot more complex than I’ve explained briefly but basically you can say
                no matter what kind of script is started, if PS did not show up in the menu Stop Script it ended.
                If this also means that functionality is still running.

              I hope this makes sense to you.

              1 Reply Last reply Reply Quote 4
              • Gerald KirchnerG
                Gerald Kirchner
                last edited by

                I do not get Python Script in the Plugins menu.
                First installed plugin manager. Then error message when installing Python Script:
                “A file needed by the plugin manager (gpup.exe) is not present under the updater directory. You should update or reinstall the Plugin Manager plugin to fix this problem. Notepad++ will not restart.”
                Manual copy as described in PythonScript.chm did not work either.
                Then completely uninstalled and deleted all leftovers in %ProgramFiles% and %appdata%.
                npp.7.6.3.bin.x64.7z and PythonScript_Full_1.0.8.0.7z unpacked in the same directory. It does not work.

                Eko palypseE 1 Reply Last reply Reply Quote 0
                • Eko palypseE
                  Eko palypse @Gerald Kirchner
                  last edited by

                  @Gerald-Kirchner

                  unfortunately plugin installation is a little bit of a mess at the moment.
                  Would you mind posting your current debug-info from ?-menu
                  and in the meantime extract the PythonScript_Full_1.0.8.0.7z to a folder of your choice.

                  Once we know how your current setup looks like we can give the information what needs
                  to be copied/moved where to.

                  1 Reply Last reply Reply Quote 1
                  • Gerald KirchnerG
                    Gerald Kirchner
                    last edited by

                    @Eko-palypse

                    As described fresh portable installation.
                    “npp.7.6.3.bin.x64.7z” and “PythonScript_Full_1.0.8.0.7z” unpacked in the same directory.

                    Notepad++ v7.6.3 (64-bit)
                    Build time : Jan 27 2019 - 17:16:47
                    Path : D:\Daten\PortableApps\Notepad++\notepad++.exe
                    Admin mode : OFF
                    Local Conf mode : ON
                    OS : Windows 10 (64-bit)
                    Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll

                    1 Reply Last reply Reply Quote 0
                    • Eko palypseE
                      Eko palypse
                      last edited by Eko palypse

                      @Gerald-Kirchner said:

                      Local Conf mode : ON

                      Local Conf mode : ON tells us, that the local install directory
                      is searched for the plugins and configs.

                      This means, from the extracted PythonScript folder copy
                      the plugins folder into D:\Daten\PortableApps\Notepad++\
                      which basically asks for overwritting the plugins folder.

                      The move the file PythonScript.dll from
                      D:\Daten\PortableApps\Notepad++\plugins
                      into
                      D:\Daten\PortableApps\Notepad++\plugins\PythonScript\

                      Finally copy the python27.dll from the extracted 7z into
                      D:\Daten\PortableApps\Notepad++

                      layout should be

                      D:\
                        Daten\
                          PortableApps\
                            Notepad++\
                              plugins\
                                PythonScript\
                                   lib\
                                   scripts\
                                   Pythonscript.dll
                              python27.dll
                      

                      Restart npp and you should see PythonScript plugin in the menu

                      1 Reply Last reply Reply Quote 2
                      • Gerald KirchnerG
                        Gerald Kirchner
                        last edited by

                        @Eko-palypse
                        There were 2 problems.
                        “\Notepad++\plugins\PythonScript.dll” instead of “\Notepad++\plugins\PythonScript\PythonScript.dll”. Wrong path packed in “PythonScript_Full_1.0.8.0.7z”.
                        PythonScript is 32-bit and I had npp 64-bit.
                        Solved.

                        @Meta-Chuh
                        I have saved the script under \Notepad++\plugins\Config\PythonScript\scripts. Initialization placed on ATSTARTUP. Click the script in the menu.
                        Nothing. No red color to see. I have to learn python.
                        self.lexer_name = ‘DSM_Sprache_gk_1902’ does not work too. This is the name of the imported language file.
                        The configured toolbar icon is not displayed. Even the preview in “Toolbar Icons” is empty.
                        With activated console and call from the menu

                        Traceback (most recent call last):
                          File "D:\Daten\PortableApps\Notepad++\plugins\Config\PythonScript\scripts\DSM_block-comment.py", line 10, in <module>
                            EnhanceUDLLexer().main()
                          File "D:\Daten\PortableApps\Notepad++\plugins\Config\PythonScript\scripts\DSM_block-comment.py", line 24, in __call__
                            cls._instance = super(SingletonEnhanceUDLLexer, cls).__call__(*args, **kwargs)
                          File "D:\Daten\PortableApps\Notepad++\plugins\Config\PythonScript\scripts\DSM_block-comment.py", line 117, in __init__
                            self.configure()
                          File "D:\Daten\PortableApps\Notepad++\plugins\Config\PythonScript\scripts\DSM_block-comment.py", line 70, in configure
                            editor1.indicSetStyle(0, INDICATORSTYLE.TEXTFORE)
                        AttributeError: type object 'INDICATORSTYLE' has no attribute 'TEXTFORE'
                        

                        And in PythonScript 1.0.8.0 documentation is missing TEXTFORE at INDICATORSTYLE

                        1 Reply Last reply Reply Quote 0
                        • Eko palypseE
                          Eko palypse
                          last edited by

                          @Gerald-Kirchner said:

                          PythonScript_Full_1.0.8.0.7

                          overlooked this one, current version is 1.3

                          error is most probably related to not having the current version installed.

                          1 Reply Last reply Reply Quote 2
                          • Gerald KirchnerG
                            Gerald Kirchner
                            last edited by

                            I go to NPP -> ? -> Get More Plugins -> http://docs.notepad-plus-plus.org/index.php/Plugin_Central -> Python Script -> http://npppythonscript.sourceforge.net/download.shtml
                            Latest Version 1.0.8.0
                            No indication for newer versions. Please change the link to the newer version.

                            Now with v1.3.0

                            Traceback (most recent call last):
                              File "D:\Daten\PortableApps\Notepad++\plugins\Config\PythonScript\scripts\DSM_block-comment.py", line 4, in <module>
                                import ctypes
                            ImportError: No module named ctypes
                            
                            Meta ChuhM 2 Replies Last reply Reply Quote 0
                            • Eko palypseE
                              Eko palypse
                              last edited by

                              May I ask you which PythonScript package you installed?

                              1 Reply Last reply Reply Quote 1
                              • Eko palypseE
                                Eko palypse
                                last edited by Eko palypse

                                It looks like the minimum package does not contain the ctypes module.
                                I would propose to install the full package.

                                1 Reply Last reply Reply Quote 2
                                • Meta ChuhM
                                  Meta Chuh moderator @Gerald Kirchner
                                  last edited by Meta Chuh

                                  hi @Gerald-Kirchner @Eko-palypse @PeterJones and all,
                                  sorry i was offline for a while.

                                  here is the correct guide to install the latest 1.3.0.0 pythonscript on notepad++ according to your last debug info:

                                  Notepad++ v7.6.3 (64-bit)
                                  Build time : Jan 27 2019 - 17:16:47
                                  Path : D:\Daten\PortableApps\Notepad++\notepad++.exe
                                  Admin mode : OFF
                                  Local Conf mode : ON
                                  OS : Windows 10 (64-bit)
                                  Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll

                                  • download and extract PythonScript_Full_1.3.0.0_x64.zip from >>> here <<< (do not use any other release type except this zip).

                                  • copy PythonScript.dll from the plugins folder of this zip to:
                                    D:\Daten\PortableApps\Notepad++\plugins\PythonScript\PythonScript.dll

                                  • copy python27.dll to:
                                    D:\Daten\PortableApps\Notepad++\python27.dll

                                  • copy the folders scripts containing machine level scripts and lib containing python libraries, from the zip’s plugins\PythonScript folder to:
                                    D:\Daten\PortableApps\Notepad++\plugins\PythonScript\lib\
                                    D:\Daten\PortableApps\Notepad++\plugins\PythonScript\scripts\

                                  note: for a pythonscript installation guide on your installed notepad++ version, i would need another debug info of it, as it has to be adapted acordingly.

                                  1 Reply Last reply Reply Quote 3
                                  • Gerald KirchnerG
                                    Gerald Kirchner
                                    last edited by

                                    PythonScript_Min_1.3.0.0 changed to PythonScript_Full_1.3.0.0. I stay at 32-bit first.
                                    (Also in PythonScript_Full_1.3.0.0_x64.zip the PythonScript.dll is in the wrong folder.)

                                    Now it works for manual execution.
                                    Is there a way to automate that?
                                    “import DSM_block-comment” in startup.py not working
                                    It also does not work if I write the complete code to the end of startup.py (Initialization placed on ATSTARTUP).

                                    Meta ChuhM 2 Replies Last reply Reply Quote 2
                                    • Meta ChuhM
                                      Meta Chuh moderator @Gerald Kirchner
                                      last edited by

                                      @Gerald-Kirchner

                                      one more thing that might be helpful to you:
                                      to edit startup.py or any other script from the gui, instead of searching for it in an explorer window: go to plugins > python script > scripts and hold [ctrl] while clicking on a script.

                                      1 Reply Last reply Reply Quote 2
                                      • Meta ChuhM
                                        Meta Chuh moderator @Gerald Kirchner
                                        last edited by

                                        @Gerald-Kirchner

                                        Also in PythonScript_Full_1.3.0.0_x64.zip the PythonScript.dll is in the wrong folder.

                                        yes, all pythonscript releases have the wrong (old) folders.
                                        that’s why we copy the files manually to their correct locations.

                                        Now it works for manual execution.
                                        Is there a way to automate that?

                                        i’m glad you’ve managed to get it running as an extra user script.
                                        i’ll have a look at why the auto startup does not work.

                                        1 Reply Last reply Reply Quote 2
                                        • Meta ChuhM
                                          Meta Chuh moderator @Gerald Kirchner
                                          last edited by Meta Chuh

                                          @Gerald-Kirchner

                                          Now it works for manual execution.
                                          Is there a way to automate that?
                                          “import DSM_block-comment” in startup.py not working
                                          It also does not work if I write the complete code to the end of startup.py (Initialization placed on ATSTARTUP).

                                          i’ve noticed, that 1.3.0.0 has startup.py disabled by default.
                                          please go to plugins > python script > configuration and recheck initialisation to ATSTARTUP instead of LAZY.

                                          (you have already done that, but just make sure)

                                          after you have done that, the script should work immediately on notepad++ startup, when added eg. below the last line of the original startup.py script, as you have correctly done before, unless startup.py itself is not visible at the plugins > python script > scripts dropdown menu. we then have to recheck where it has been copied to.


                                          easy way to check if startup works:
                                          paste :

                                          print "hello world"
                                          

                                          below the line:

                                          sys.stdout = console
                                          

                                          of a default startup.py.

                                          the text hello world should be visible when you open the python script console.

                                          1 Reply Last reply Reply Quote 2
                                          • Eko palypseE
                                            Eko palypse
                                            last edited by

                                            I recommend creating a new startup.py via the python script plugin menu New Script
                                            instead of using the default one, simply because the default one gets overwritten
                                            when a new version of python script gets installed.

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