SOLVED: need help running code from Notepad++ with the NppExec plugin
#1
Hey everyone.

A while ago I asked about setting up Notepad++ to compile/debug QB64 code, and TempodiBasic graciously provided some instructions which I finally got around to trying out, only it's not (fully) working.

I'm running Windows 10 Pro with QB64 2.0.2, and Notepad++ which self-updated to v8.3.3 today and works fine. 
Per the instructions, I installed the NppExec plugin, and added the QB64 folder to the system path, and rebooted.

I have a "hello world" program in my qb64 folder, e.g.
  • C:\Users\{username}\Documents\Code\qb64\programs\hello1.bas

which is opened in Notepad++. 
I went in the Plugin menu and selected NPPExec, and configured it per the instructions
checking the options Show NppExec Console, Console Command History and Follow $(CURRENT_DIRECTORY).

Then with my program open in the editor, I pressed F6 for "Execute NppExec Script..."
and a command window opened.

I typed the command:
Code: (Select All)
QB64.EXE -c "$(FULL_CURRENT_PATH)" -o "$(FULL_CURRENT_PATH)"
NPP_RUN $(CURRENT_DIRECTORY) && $(NAME_PART) && ".exe"

and saved it, and clicked OK.

A DOS window opens and it looks like QB64 is compiling my code
(so far so good) and then Windows opens the \qb64\programs\ folder in Explorer,
and I can see my program now has an EXE file created with the current date/time. 

In Notepad++, the NppExec console has:

QB64.EXE -c "C:\Users\{username}\Documents\Code\qb64\programs\hello1.bas" -o "C:\Users\{username}\Documents\Code\qb64\programs\hello1.bas"
Process started (PID=8892) >>>
<<< Process finished (PID=8892). (Exit code 0)
NPP_RUN: C:\Users\{username}\Documents\Code\qb64\programs && hello1 && ".exe"
================ READY ================

The problem is the EXE is compiled but not being run (I have to double-click on it to actually execute it, and it does work).

Is there anything I should change or add to the F6 command to make NppExec actually run the code once it's compiled?

I checked my Windows Security & antivirus and am not seeing any warnings or anything, so I don't think that's the issue.

Any help much appreciated...
Reply
#2
My best guess would be to change the second line to use $(FULL_CURRENT_PATH) too, instead of $(CURRENT_DIRECTORY).

$(CURRENT_DIRECTORY) is IMHO the current directory of the notepad++.exe and not the directory where your hello1.exe is.
Reply
#3
(05-06-2022, 04:18 PM)RhoSigma Wrote: My best guess would be to change the second line to use $(FULL_CURRENT_PATH) too, instead of $(CURRENT_DIRECTORY).

$(CURRENT_DIRECTORY) is IMHO the current directory of the notepad++.exe and not the directory where your hello1.exe is.

Thanks for your reply. I tried that, which caused Windows to prompt 

How do you want to open this file?
(Google Chrome, Notepad++, Look for an app in the Microsoft Store, More Apps)
[x] Always use this app to open .bas files. 


The console output showed the problems: 
NPP_RUN: C:\Users{username}\Documents\Code\qb64\programs\hello1.bas && hello1 && ".exe"

which are 
  1. $(FULL_CURRENT_PATH) includes the source file (.bas) name
  2. the "&&" and quotes are interpreted as literals

Reading the NppExec help pointed me to "NppExec.txt" located in the plugin folder, which documents all the tags (and also commands - it seems NppExec has its own rudimentary scripting language!)

So $(CURRENT_DIRECTORY) was right after all, I was just appending wrong.
BTW they do have a tag for the Notepad++ EXE folder, which is $(NPP_DIRECTORY)

So after reading through the doc and examples, I found the format that worked:

QB64.EXE -c "$(FULL_CURRENT_PATH)" -o "$(FULL_CURRENT_PATH)"
NPP_RUN $(CURRENT_DIRECTORY)\$(NAME_PART).EXE


For anyone else who wants to make QB64 work with Notepad++ or do anything more fancy, check out the docs 
  • NppExec.txt
  • NppExec_HelpAll.txt
  • etc. 

in the NppExec plugin folder under the Notepad++ directory, which on my Windows 10 machine was at 
  • C:\Program Files (x86)\Notepad++\plugins\NppExec\doc\NppExec\

Hope this helps someone
Rolleyes
Reply




Users browsing this thread: 1 Guest(s)