Using text in n++ window as input for function

  • Hello,

    I’m not really a programmer but am working on a plugin that alleviate some repetitive formatting I need to do multiple times daily for a system. So far I have the c# code functioning as intended and I’ve added it into a template from the plugin page while making some modifications to the template.

    I am at a point where I should just need to get the input for the plugin and it should be ready to start testing. Unfortunately I’m not sure how to do this. I imagine that the namespace or some other prebuilt template code is used for this but I’m having a heck of a time finding it on my own looking through everything. I’ve also tried looking for example source code in hopes of finding a plugin that does something similar but to no fruition.

    I guess, for a straight example, say I open up notepad++ and type in “Hello world !” - I would like to have my plugin use that text on the window to, lets say insert a new line for every space, so the plugin would alter the text on the window from…

    Hello world !



    This seems like it would be a basic thing for plugins to do, so my apologies, I’m afraid my lack of experience makes sifting through the template a very overwhelming task. Thank you in advance for any assistance.

  • @Michael-Germon

    the first hing to understand is that a plugin has to work with at least two core objects,
    namely notepad++ and scintilla.
    Scintilla is the core component which is responsible for modifying/styling the text.
    Which means that in your case in order to be able to retrieve the text you need to
    get a reference/instance of the scintilla object and send/call the SCI_GETTEXT method.
    How this is done in C# - I don’t know.
    With pythonscript plugin it is as easy as calling editor.getText() as the plugin
    provided editor being the scintilla component and getText being a wrapper around SCI_GETTEXT.

  • Thank you Eko! I should be able to figure it out from here.

  • well where is your repository at

Log in to reply