using the Autohotkey as a portable package does give some pain, for example the menu item 'Edit This Script ' does it with Notepad. And as it is well known it is a little bit difficult to change the default txt editor of M$ Windows. But I want to use a better one so I cooked up the below solution. It is using the Debugger registry trick (adds one registry entry) and works perfectly on XP. Even opens multiple files from Windows Explorer to the Notepad++.
First compile the below as NotepadChanger.exe and then save that exe to the %systemroot% folder (usually C:\winNT or C:\windows):
#NoTrayIcon
Loop, %0%
{
if A_Index = 1
{
EditorFullpath := %A_Index%
}
else if A_Index > 2
{
param := param A_Space %A_Index%
}
}
param := Trim(param)
run, %EditorFullpath% %param%
ExitAppthen run this script:
FileSelectFile, SelectedFile, 3, , Browse to and Select the Executable of Your Favorite Text Editor:, Executable (*.exe)
SplitPath, SelectedFile, OutFileName
if SelectedFile =
{
MsgBox, User cancelled, no actions taken.
}
else if OutFileName = notepad.exe
{
Msgbox, notepad.exe would create a infinite loop.`n`nExit with no actions taken.
ExitApp
}
else
{
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe, Debugger, NotepadChanger.exe "%SelectedFile%"
RegRead, RegEntry, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe, Debugger
msgbox, The following Registy entry was created:`n`nKEY: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options`nSUBKEY: notepad.exe`nVALUE: Debugger`nDATA: %regEntry%
}
ExitApp
With Best Regards,
Timo




