Community
    • Login

    Help with generating clickable links or something of that sort

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 4 Posters 830 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 @jakima
      last edited by

      @jakima

      wait, let me try to get this right.
      Your goal is to run a cmd/batch file and the result of that batch file
      contains links which you want to click and those will bring you to the location in that file, correct?

      Like in this example
      4678731f-6f3a-462b-ba3b-c359c913b6d7-image.png

      If I would click on the link in the Python console it would
      a) open the file test.py and
      b) set the caret to line 2

      Is it that what you try to achieve?

      jakimaJ 2 Replies Last reply Reply Quote 1
      • jakimaJ
        jakima @Ekopalypse
        last edited by

        @Ekopalypse
        exactly

        1 Reply Last reply Reply Quote 0
        • jakimaJ
          jakima @Ekopalypse
          last edited by jakima

          @Ekopalypse
          can i manually generate such links in console? using python scripter of course

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

            @jakima

            yes you can, assuming the following batch file

            @echo off
            SET a=  File
            SET b=, line 3, in
            SET c=%a% "%0"%b%
            echo %c%
            

            and calling the batch from either the console or via script with

            console.run(r"cmd.exe /c d:\mybatch.bat")

            would result in something like

            db601700-b891-4fbd-9ab8-ce9e519db85a-image.png

            and clicking on the link will do what I assume you want to do.

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

              @Ekopalypse

              Just how does the Pythonscript console do those underlined links?
              One presumes the console window is just another Scintilla window…

              It might be nice if in Notepad++ tab windows filenames would appear that way, and provide an easier way for opening files into N++ than the built in open-file-under-caret mechanisms (which aren’t too good).

              The P.S. console window even nicely handles filepaths with spaces in them; but this is a more “controlled” environment where a tool is handling the path/filename creation, so it may be easier to handle than free-form user text in a N++ tab.

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

                @Alan-Kilborn

                Just how does the Pythonscript console do those underlined links?

                it does act like a lexer.
                It waits for the SCN_STYLENEEDED notification and styles the output text accordingly.

                1 Reply Last reply Reply Quote 2
                • jakimaJ
                  jakima @Ekopalypse
                  last edited by

                  @Ekopalypse
                  ok i’ll try this. thank you.
                  but… can python script directly interact with the text file to print to console?

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

                    @jakima said in Help with generating clickable links or something of that sort:

                    but… can python script directly interact with the text file to print to console?

                    yes, run it through this console.run(r"cmd.exe /c d:\mybatch.bat")
                    it will redirect the output of the cmd window to the console window.

                    jakimaJ 3 Replies Last reply Reply Quote 3
                    • jakimaJ
                      jakima @Ekopalypse
                      last edited by

                      @Ekopalypse
                      ah, ok. again thanks a lot.

                      1 Reply Last reply Reply Quote 0
                      • jakimaJ
                        jakima @Ekopalypse
                        last edited by

                        @Ekopalypse
                        you’re awesome!!!
                        it works as expected.
                        sure, i have to figure out the iterating over notepad part. but yeah, it works!!!
                        i cant thank you enough

                        1 Reply Last reply Reply Quote 2
                        • jakimaJ
                          jakima @Ekopalypse
                          last edited by

                          I figured out the iterating part and found some other things while at it

                          • the output from the bat has to be on a new line or it wont work

                          • you dont necessarily need the “, in” part in the second variable ‘b’

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

                            @jakima

                            Yes, it must start with <space><space>File<space>" to be identified as an “linkeable” string
                            and then it reads the rest of that line to see what kind of informations are available.

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