How to create a right-click context shell shortcut “edit with Emacs”?

前端 未结 8 819
离开以前
离开以前 2021-01-30 11:22

Notepad++ automatically adds a shell shortcut so that when you\'re in Windows Explorer, you can right-click on a file and select \"edit with Notepad++\". How can I do the same w

8条回答
  •  野的像风
    2021-01-30 12:16

    I want to add to polyglot's answer above -- the AutoHotkey shortcut he mentions is very handy, but the code is incomplete: the GetText() function was written by somebody on the AutoHotkey forum (http://www.autohotkey.com/forum/viewtopic.php?p=279576#279576), and it is:

    GetText(ByRef MyText = "")
    {
       SavedClip := ClipboardAll
       Clipboard =
       Send ^c
       ClipWait 0.1
       If ERRORLEVEL
       {
          Clipboard := SavedClip
          MyText =
          ERRORLEVEL := 1
          Return
       }
       MyText := Clipboard
       Clipboard := SavedClip
       Return MyText
    }
    
    ;to test: 
    #k::
    GetText(FileName)
    msgbox clipboard=%FileName%
    return
    

    Note that ClipWait delay might need to be modified: I had to set it to 2!

提交回复
热议问题