Thanks for your quick reply. I dived in and learned a bit of scripting in AkelPad.
As an AkelPad user and developer I was unhappy with its Notepad replacement solution, so I've been trying to get the "Image File Execution Options" solution to work (I'll post the full solution in a separate post). In my opinion it is a better solution to use that registry hack as you maintain 1 place where AkelPad is installed, works for x64 and x86 processes, requires only 1 small change - the registry. The current solution uses a stub process to ensure that any
waits done on the processes work (and not immediately return), as well as pass process exit codes from the real AkelPad instance to the stub and then to the caller (I haven't tested the latter, but I trust it works). This stub process has to be placed in several locations in the system - and I can tell you as a daily user of AkelPad (sometimes with 50+ instances opened at once) that Explorer gets confused when it tries to group them in the task bar. For some reason, sometimes it happens, that when I start Notepad (AkelPad) it opens up as the last process on the task bar,
not grouped with other AkelPad instances. The other obvious disadvantage of the stub process is double the amount of processes.
So with those disadvantages in mind, I decided to make the "Image File Execution Options" method work as best as possible because it is the cleanest way. I've seen other solutions posted online and they overlook things here and there, like waiting on process, or other various ways the original Notepads get called, and nuances of command line parameters (quotes, spaces etc, etc).
Before I post my solution in the next post, I want to say this: AkelPad has "\Z" switch. It *almost* works.
See where it doesn't:
First, set up AkelPad as Notepad replacement by navigating to this key in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
Create a key called
notepad.exe
Then create a string called
Debugger
and set it to:
C:\AkelPad\AkelPad.exe /Z
Go to
cmd
CD to a directory with a text file, for example, 1.txt
Now type this:
notepad 1.txt
Did it work? Not for me.
These commands do though:
notepad "1.txt"
"notepad" 1.txt
Bizarrely this one works too:
notepad "1.txt
The kind of command line parameters AkelPad receives is different there, and it's very subtle.
Corresponding to commands entered above, these are the command line parameters AkelPad would receive from Windows:
Doesn't work:
/Z notepad 1.txt
Works:
/Z notepad "1.txt"
Works:
/Z "notepad" 1.txt
Works:
/Z notepad "1.txt
If you fix this, whatever it is, that would be great.
I will post a solution in the next post, long, with scripts, but fun.