Community
    • Login

    Help w/ console.run editor output

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    3 Posts 2 Posters 116 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.
    • 4SHAKEN4
      4SHAKEN
      last edited by

      Hello,
      I’m trying to get output from an .exe call to return to the new editor window, but its only posting to the console window. Below is some “test” code to demonstrate the issue. Thanks for any help!

      from Npp import editor, notepad, console
      import time

      console.clear()
      console.show()

      notepad.new()
      time.sleep(0.3) # Delay 300ms to allow above cto complete
      console.run(r’C:\Software\dcmtk-3.6.9-win64-dynamic\bin\echoscu.exe -v -aet TEST -aec TEST123 127.0.0.1 105’, editor)
      console.run(r’cmd.exe /c “C:\Software\dcmtk-3.6.9-win64-dynamic\bin\echoscu.exe -v -aet TEST -aec TEST 127.0.0.1 105”‘, editor)
      console.run(r’cmd.exe /c ping localhost’, editor)

      test_console_editor.jpg

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

        @4SHAKEN

        The editor object used in the console is the same class as the normal editor object.

        from Npp import console
        
        console.clear()
        
        print("hello")
        
        content = console.editor.getText()
        notepad.new()
        editor.setText(content)
        

        But if you are working with external programs, the subprocess module might be a better alternative

        4SHAKEN4 1 Reply Last reply Reply Quote 3
        • 4SHAKEN4
          4SHAKEN @Ekopalypse
          last edited by

          @Ekopalypse Great, that will suffice for what I’m trying to do. Thank you!

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