Skip to content
The Chat Archive
gpt-3.5-turbo-0613· OpenAI WildChat-4.8M (AI2)

create ahk boss key script

  1. User

    create ahk boss key script

  2. Assistant

    Sure, here's a simple AutoHotKey (AHK) script that you can use as a boss key:

    ; Define the hotkey to activate the boss key
    ^+b::ToggleBossKey()
    
    ; Function to toggle the boss key
    ToggleBossKey()
    {
        ; Define the applications you want to minimize or hide
        applications := ["notepad.exe", "calculator.exe", "chrome.exe"]
    
        ; Check if any of the specified applications are currently open
        found := 0
        Loop, % applications.Length()
        {
            if (WinExist("ahk_exe " applications[A_Index]))
            {
                found := 1
                break
            }
        }
    
        if (found)
        {
            ; Minimize or hide the applications
            Loop, % applications.Length()
            {
                WinMinimize, ahk_exe %applications[A_Index%]
                ; Alternatively, you can use WinHide to hide the windows completely:
                ; WinHide, ahk_exe %applications[A_Index%]
            }
        }
        else
        {
            ; Restore the minimized or hidden applications
            Loop, % applications.Length()
            {
                WinRestore, ahk_exe %applications[A_Index%]
                WinActivate, ahk_exe %applications[A_Index%]
            }
        }
    }
    

    In this script, we define the hotkey Ctrl+Shift+B to activate the boss key. When activated, it will check if any of the specified applications (notepad.exe, calculator.exe, chrome.exe) are currently open. If any of them are open, it will minimize or hide them depending on the commented out section you choose (WinMinimize or WinHide). If none of the specified applications are open, it will restore them from the minimized or hidden state using WinRestore and bring them to the front using WinActivate.

    To use this script, you'll need to have AutoHotKey installed on your computer. Once installed, create a new text file, copy and paste the script into it, and save with a .ahk extension. Double-click the file to run the script. Now, when you press Ctrl+Shift+B, it will activate the boss key functionality.