Community
    • Login

    Python script plugin alternative working with python 3?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    pythonscriptpython
    5 Posts 2 Posters 3.9k Views 2 Watching
    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.
    • Crn DC Offline
      Crn D
      last edited by

      Hi!
      I just discovered the awesome python script plugin, and then… that it got stuck in python2.

      Is there a way to run a python (3.6) script that would do it’s work in the text of a specific tab?
      For instance how can run a simple script that would apply the python function upper() to the text *. The way pythonscript was working with scientilla was awesome : editor.getText() do something with it and then editor.setText().

      It’s possible to add custom macro, and call them using shortcut (or launch them from the menu). But is it possible to do the same with a python3 script?

      (I know it’s possible to run script using Pynpp, among other options. I’m looking for a way to run a script that would work on np++ tab)

      *I know there is other solution for that: it’s an example. A typically 3.6 example would be to run this script :
      answer = editor.getText()
      editor.addText(print(f"did notepad++ made it? {answer}."))

      on a tab containing this:
      “yes, as always!”

      1 Reply Last reply Reply Quote 0
      • Crn DC Offline
        Crn D
        last edited by

        For those who also wonder, the work around is to use a python3.6 script that work with files (and not scintilla). Past the text that need to be processed in a tab, and run it from the tab of the script.

        ps: This python 3.6 script below won’t work through the “python script” plugin:

        Mytext = editor.getText()
        editor.addText(print(f"my text is: {MyText}."))

        ps about the notepad forum:
        1: the bottom of the text field doesn’t show in chrome.
        2: a button to cancel an edit is also missing

        1 Reply Last reply Reply Quote 0
        • YaronY Offline
          Yaron
          last edited by

          Hello,

          Related:
          You may find the LuaScript Plugin useful.
          @dail has done a great work.


          ps about the notepad forum:
          1: the bottom of the text field doesn’t show in chrome.

          This frequently happens in Firefox too.

          Best regards.

          1 Reply Last reply Reply Quote 0
          • Crn DC Offline
            Crn D
            last edited by

            that’s interesting, I did not know about that langage. Thanks for the link!

            1 Reply Last reply Reply Quote 0
            • YaronY Offline
              Yaron
              last edited by

              You’re welcome.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors