2020-03-17 12:18:02 (edited by ambro86 2020-03-17 15:52:53)


You will wonder, why an article on Notepad ++? It is well known that any code can be written, as it is an editor. But this article is not about writing code, but will explain how to run any code via Notepad ++. Yes, you got it right. In this program you can also run the code, and make it appear in a console, within the program itself. This function is very useful, as otherwise you would have to write the code, go to the command prompt and run it separately. Running everything from Notepad ++ saves time, as well as having a quick and accessible interface, both for writing and for the console. At the beginning we refer to Python, but it will not be a problem to adapt this procedure to other programming languages too, and we will give some examples.
Let's begin!

The guide on Python

First download and install Notepad ++. It can be found at: https://notepad-plus-plus.org/downloads/
Now open it, and let's go to the plugin menu, then plugin management.
Search for the plugin NppExec. Now install it. It will ask you to restart.

Now we find where the python.exe file is located. Open the prompt with
windows r, write cmd.exe, and type: where python. Copy the path.

Let's go back to notepad ++.
Now press f6 to execute our file with NppExec. Will ask us to
enter the command.

In the first line we write cd, a space, open the quotes and copy all the
path except python.exe. Close the quotes, make a new line, and write
python, followed by a space and "$ (FULL_CURRENT_PATH)"
The command will look like

cd "C:\Users\xxx\AppData\Local\Microsoft\WindowsApps"

Attention to respect also the new line. In the first line we go to
python folder. In the second we run python.exe, just like
if we were on command prompt.

We can also save our execution program, by calling it,
for example, Python.

When we run our script, a console window will appear
which however is not automatically focused. You can read with the Jaws cursor, or with Nvda object navigator, but there is a better method.

Let's go to the configuration menu, and choose shortcut keys. Now let's press
the right arrow until you find Plugin Commands.
In the search field we write np.
Now with the Jaws cursor, or with the Nvda object navigator look for the command toggle console and click twice. We will have to modify it. I entered control
shift f2. Press ok and you're done! Whenever we press
control shift f2 we will switch from the console window to the

In the plugins menu, select NppExec and deselect Console Commands
History. So it will take away some lines in the console window that annoy us, because they disturb the reading of the executed program.
Now let's go to the configuration menu, preferences, languages, and in
tabulations we choose python. Otherwise, indentations will not be correct for Python when writing.

Our first program

At this point create a new file. Let's save it with a .py extension.
From the language menu, choose python.

Now in the editor we write a very simple code:

print ("Hello, world!")

At this point save the file, with control s, press f6 and choose to run with Python.
We will be very pleased to note that if we go to the console window, with the key we have chosen, we will be able to read the result of our program very easily and in an accessible way.

Another example: Bgt

Now let's see how to apply the same procedure to other programming languages, for example Bgt.
Let's create a new file on Notepad ++ and save it with .bgt extension.
Let's write our code.

void main()    
alert("Hello", "I am a BGT script!");

Now save the file with control s.
When we want to run it we press f6. The window will open asking for the command to be executed. We will not choose Python but we will enter a temporary command. For example, the line to copy will be this:

cd "C:\Program Files (x86)\BGT"

Here too, respect the carriage return. We will therefore be able to execute our code instantly, and if there are any errors, the Bgt window will appear directly, informing us of the error in the code.
Of course, as we did for Python, we can save the command that executes Bgt. In this way, pressing f6 we will have the list of all the commands that we have saved.


In this guide we have seen how to write and execute our code in Python. But we have shown how this can be applied to any programming language, as the plugin used on Notepad ++ simulates the use of the command prompt.
This procedure allows us to read the result of our program in an easy and accessible way. If our program will not be run on a console window, but on a Windows window, there will be no problem, as the Windows window will open and executes the code entered by us.

Thumbs up +8