• Login
Community
  • Login

[tip] F7 toggle search panel

Scheduled Pinned Locked Moved General Discussion
1 Posts 1 Posters 350 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    Gubith
    last edited by Nov 19, 2021, 8:25 PM

    This Autohotkey script worked great for me - toggles the search panel (F7):

    https://superuser.com/questions/700357/create-a-hotkey-keyboard-shortcut-to-close-the-notepad-find-results-window/700358#700358

    I added #SingleInstance,force

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Ed Cottrell's AutoHotKey script for toggling the "Find Results" pane/window in Notepad++
    ; Released under the MIT License (http://opensource.org/licenses/MIT)
    ; Version: 1.1
    ; Release Date: January 15, 2014
    ; Released on Superuser.com: http://superuser.com/questions/700357/create-a-hotkey-keyboard-shortcut-to-close-the-notepad-find-results-window
    ; Also released at www.edcottrell.com/2014/01/11/toggle-find-results-window-notepad-hotkey/
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    #SingleInstance,force
    ; Turn F7 into a toggle for the Notepad++ search results window; currently it shows it, but doesn't hide it.
    ; The $ prevents this from firing itself
    *$F7::
    Open := 0
    SetTitleMatchMode 2  ; AHK doesn't seem to recognize the window title otherwise
    ; See if Notepad++ is the active window or if the undocked results window (ahk_class #32770) is the active window
    If WinActive("Notepad++")
    {
        ; If the results pane is open, close it
        ; Button1 is the class name for the title bar and close button of the results pane when docked
        ControlGet, OutputVar, Visible,, Button1, Notepad++
        if ErrorLevel = 0
        {
            If OutputVar > 0
            {
                ; Found it docked
                Open := 1
                ; Get the size and coordinates of the title bar and button
                ControlGetPos, X, Y, Width, Height, Button1
                ; Set the coordinates of the close button
                X := Width - 9
                Y := 5
                ; Send a click
                ControlClick, Button1,,,,, NA x%X% y%Y%
            }
        }
    }
    ; If it is undocked, use ahk_class #32770
    else If WinExist("Find result ahk_class #32770")
    {
        ; Found it undocked
        Open := 1
        ; Close it
        WinClose
    }
    ; It's not open, so open it
    if Open = 0
    {
        SendInput {F7}
    }
    return
    
    1 Reply Last reply Reply Quote 1
    1 out of 1
    • First post
      1/1
      Last post
    The Community of users of the Notepad++ text editor.
    Powered by NodeBB | Contributors