Menu

#1510 How to better replace Notepad with SciTE?

Duplicate
open
nobody
4
2024-05-27
2024-02-13
434F4C41
No

Notepad2 uses the following trick to replace the original Windows Notepad.

In summary it uses Windows' image execution options to redirect calls from Notepad.exe to C:\\Program Files\\Notepad2\\Notepad2.exe /z -- the option /z tells Notepad2 to ignore argv[1] and concatenate the rest of the arguments into a single filename.

In doing the above for SciTE, the following is my progress so far. The purpose of this thread is to kindly ask the author of SciTE to implement Notepad2's methods such that I can get rid of the kludge below:

Added to registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="\"C:\\Windows\\System32\\wscript.exe\" \"C:\\Scripts\\SciteRunner.vbs\""

C:\Scripts\SciteRunner.vbs:

Dim FileName, CmdLine

For I = 1 To WScript.Arguments.Count - 1
    FileName = FileName & WScript.Arguments.Item(I)
    If I <> WScript.Arguments.Count - 1 Then
        FileName = FileName & " "
    End If
Next

FileName = Replace(FileName, "\", "\\")
CmdLine = """C:\wscite\SciTE.exe"" ""-open:" & FileName & """"
CreateObject("WScript.Shell").Run CmdLine, 0, True

There is an additional functionality from Notepad2 that I would like to see in SciTE: take into account the current work directory without requiring the -cwd: option. Currently SciTE ignores the start directory -- this can be verified by creating a link to SciTE.exe and changing the "Start in:" field -- SciTE will try so Save As in the previously used directory.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2024-02-13
    • labels: --> SciTE, win32
    • Priority: 5 --> 4
     
  • Neil Hodgson

    Neil Hodgson - 2024-02-13

    I don't understand the explanation here and would prefer to see a patch.

     
  • Zufu Liu

    Zufu Liu - 2024-03-04

    https://github.com/zufuliu/notepad2/wiki/System-Integration#replace-windows-notepad-via-registry

    /z tells Notepad2 to skip next parameter (path for Windows Notepad.exe) when user click explorer's Edit, Open or Print (set extra parameter /p) context menus. Notepad2 is invoked with following parameters:

    Edit & Open:
    /z C:\Windows\System32\Notepad.exe <full-file-path>
    
    Print without showing dialog box (PD_RETURNDEFAULT):
    /z C:\Windows\System32\Notepad.exe /p <full-file-path>
    
     
  • Zufu Liu

    Zufu Liu - 2024-03-04

    Here is code for registry changes (changes other than Debugger are required for Win11).
    https://github.com/zufuliu/notepad2/blob/main/src/Dialogs.c#L2827

     
  • Zufu Liu

    Zufu Liu - 2024-05-27
    • Group: Initial --> Duplicate
     
  • Zufu Liu

    Zufu Liu - 2024-05-27

    Duplicate of [feature-requests:#833], which had a patch.

     

    Related

    Feature Requests: #833


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.