Jump to content

Recommended Posts

Posted

If you use notepad+ as an editor for Autolisp, the CTRL+ALT+b leaves a lot to be desired when it comes to selecting between brackets.

 

The VLIDE double-click is much more satisfying.

 

So here is an AutoHotKey script that gives you  this functionnality while preserving the normal Dbl-Click of notepad+:

 

#Requires AutoHotkey v2.0
#SingleInstance Off 

; 1. Set up a unique communication highway (MsgNumber 0x401)
OnMessage(0x401, ReceiveCloseSignal)
ReceiveCloseSignal(wParam, lParam, msg, hwnd) {
    ExitApp
}

; 2. Find any running old instance (ignoring itself) and send it the "Self-Destruct" signal
DetectHiddenWindows True
if (oldScriptHwnd := WinExist(A_ScriptFullPath " ahk_class AutoHotkey")) {
    if (oldScriptHwnd != A_ScriptHwnd) { ; Ensure the script doesn't close itself!
        PostMessage(0x401, 0, 0, , "ahk_id " oldScriptHwnd)
        WinWaitClose("ahk_id " oldScriptHwnd, , 2)
    }
}

; 3. Automatically relaunch the script using UI Access to bypass UAC entirely
if !A_IsCompiled && !InStr(A_AhkPath, "_UIA.exe") {
    uiaPath := RegExReplace(A_AhkPath, "\.exe$", "_UIA.exe")
    if FileExist(uiaPath) {
        try {
            Run('"' uiaPath '" "' A_ScriptFullPath '"')
            ExitApp
        }
    }
}

; 4. Your Application-Specific Hotkeys
#HotIf WinActive("ahk_class Notepad++")

~LButton:: {
    static lastClick := 0
    currentClick := A_TickCount
    
    if (currentClick - lastClick < DllCall("GetDoubleClickTime")) {
        KeyWait("LButton")
        Sleep(60) 
        SendEvent("^!b")
        lastClick := 0
    } else {
        lastClick := currentClick
    }
}
#HotIf

 

Link to download AutoHotKey https://www.autohotkey.com  also available on Microsoft app store (Free)

NppBrackets.ahk

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...