Search code examples
notepad++programmers-notepad

Automate a blank space or carriage return on NotePad ++ at certain intervals


Is it possible to automate or write a macro that will issue either a blank space(or any character) or carriage return in NotePad ++ at certain intervals?

For example, if I wanted issue the letter 'E' everytime 5mins would it be possible to automate the issuing of the letter 'E' with a macro?

I have followed the suggestion provided my Toto, however when I run the script, see image I get a black screen.

enter image description here

I created the generate.py file as directed, however when I search for it I'm unable to view it in the path Python Script>>Scripts>>xxxxxxx

I can now see the script generate, see image, but when I select nothing happens

enter image description here

I don't know what I'm doing wrong but I can't seem to get the 'generate' script to appear in the Menu under Scripts enter image description here


Solution

  • You can run a python script within the PythonScript plugin.

    If it is not yet installed, follow this guide

    • Create a script (Plugins >> PythonScript >> New Script)
    • Copy this code and save the file (for example generate.py):
    from time import sleep
    
    for i in range(10):     # The text will be appended 10 times, put the value you need
        sleep(5*60)         # 5 min
        editor.appendText("\nWHATEVER YOU WANT")
    
    • Open the file you want to modify
    • Run the script (Plugins >> PythonScript >> Scripts >> generate)
    • Done

    enter image description here