• Login
Community
  • Login

Help w/ console.run editor output

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
3 Posts 2 Posters 469 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.
  • 4
    4SHAKEN
    last edited by Mar 3, 2025, 4:50 PM

    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

    E 1 Reply Last reply Mar 3, 2025, 6:02 PM Reply Quote 0
    • E
      Ekopalypse @4SHAKEN
      last edited by Ekopalypse Mar 3, 2025, 6:04 PM Mar 3, 2025, 6:02 PM

      @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

      4 1 Reply Last reply Mar 3, 2025, 6:13 PM Reply Quote 3
      • 4
        4SHAKEN @Ekopalypse
        last edited by Mar 3, 2025, 6:13 PM

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

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