Python and Notepad ++. And not only!

Introduction

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.
Let's begin!



The guide

First download and install Notepad ++.
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"
python "$ (FULL_CURRENT_PATH)"





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
text!





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 press f6, 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.





Conclusion

We have seen in this short guide how to execute Python code directly on Notepad ++. But this procedure can be applied for any programming language. It is sufficient to modify the path of the executable, inserting, for example, the path of the interpreter of Java, C ++, or others. In this way we have an accessible editor and at the same time the possibility to execute our code instantly.



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Articles Room : ambro86 via Audiogames-reflector

Reply via email to