How can I get around NppExec's limitations?
-
I cannot do a lot of things in notepad++, such as system(“cls”), or clearing the screen in any way for that matter. After a bit of research, I believe NppExec is at fault (please tell me what I’m doing wrong if that’s not the case). I saw a thread where @dinkumoil created a script to run c++ programs in a powershell, but I have no idea how to do that, and what to do with the script that was made. Could somebody help?
-
@Lowell-Justice said in How can I get around NppExec's limitations?:
I cannot do a lot of things in notepad++
Like what?
such as system(“cls”)
What does this mean?
clearing the screen in any way for that matter.
What “screen” ?
After a bit of research, I believe NppExec is at fault
Why do you think this?
At fault for what?(please tell me what I’m doing wrong if that’s not the case).
You haven’t told us enough to be able to do this.
I saw a thread
Link?
where @dinkumoil created a script to run c++ programs in a powershell,
Maybe now we’re getting somewhere…?
I have no idea how to do that
To do what?
Didn’t dinkumoil show you, whatever it is/was?and what to do with the script that was made.
Then why do you think the script example helps you?
Could somebody help?
Probably not, unless you give some sort of detail…about ANYTHING!
-
@Alan-Kilborn No, dinkumoil just linked a script and that was about it. From what I understand, NppExec does not have all of the benefits of a command line, and dinkumoil created a script to instead make it so that NppExec opened a powershell that ran your script immediately. I was trying to figure out how I could use this script or in general how I could solve the problem of clearing the command line in c++, but the repo that he linked (https://github.com/dinkumoil/ScriptCollection/tree/master/NppExec Scripts) did not say anything about how it worked or how to use it. Everything I’ve tried has failed, and I believe this to be due to the nature of NppExec. I would just like to figure out why I cannot clear the command line and how to fix it.
-
NppExec does have a console.
Plugins => NppExec => Show Console
Open that and in the console type:
ECHO $(PLUGINS_CONFIG_DIR)
Note the output directory. If you want to use @dinkumoil script :
- close Notepad++
- copy that ‘npes_saved.txt’ file to your Notepad++ plugin config directory (the output from that command you just ran).
- Re-open Notepad++ and open a C file (note in the script you reference, it does not recognize *.cpp files, only *.c
- with the C file named with a ‘.c’ extension loaded into Notepad++, open the NppExec console (Plugins => NppExec => Show Console)
- in the NppExec console type:
\Compile_&_Run
That should do it.
Cheers.
-
@Michael-Vincent do you know if it’s possible to do this with c++?
-
Yes. I suggest reading the ample documentation for NppExec:
Plugins => NppExec => Help/Manual
Plugins => NppExec => Help/Docs…And then modifying @dinkumoil script to look for a *.cpp extension:
if "$(FileType)" == ".cpp" goto CPP_FILE
And then adding the redirect you want for CPP_FILE:
:CPP_FILE npp_exec "Run_CPP_Code" goto END
And finally add the action for the
Run_CPP_Code
- you can useRun_C_Code
in that “npes_saved.txt” file as an example.Cheers.
-
Thank you for chiming in and providing a more detailed guidance for using my script!
As an addition to what @Michael-Vincent already said: To compile and execute C code you need a C compiler, of course. For simple and quick C test programs I use the Tiny C Compiler (TCC). Its homepage provides a link to the available downloads.
For C++ you could use for example MinGW, the GCC port for Windows, you can download it from here. To get the latest version take the files
mingw-w32-bin-i686-YYYYMMDD.7z
for compiling 32 bit programs andmingw-w64-bin-x86_64-YYYYMMDD.7z
for compiling 64 bit programs whereYYYYMMDD
is a placeholder for the release date of the version.To get documentation for GCC visit this site. There you will also find a link to the documentation of the GCC v9.3 command line options.