1

Тема: AHK: свернуть активное окно правым кликом

Здравствуйте!
Возможно ли свернуть активное окно кликнув в любую область правой кнопкой мышки.

2

Re: AHK: свернуть активное окно правым кликом

Да.

3 (изменено: yalanne, 2015-06-24 11:35:04)

Re: AHK: свернуть активное окно правым кликом

Для своего окна:

Gui Show, w300 h300
OnMessage("0x0204","WM_RBUTTONDOWN")
return
WM_RBUTTONDOWN(){
WinMinimize, % "ahk_id " WinExist()
}

Для любого:

~Rbutton::
MouseGetPos, , , id
WinMinimize, % "ahk_id " id
return

4

Re: AHK: свернуть активное окно правым кликом

я нашел более подходящий код, но мне нужно что бы он срабатывал когда я отпускаю левую кнопку мышки и еще нужно гдето влепить sleep 1000


RButton::
RButton_used := GetKeyState("RButton", "P")
; MsgBox,,,LButton_used = %LButton_used% ; for trouble shooting

not_an_exception := true ; default value
    
    ;Start of Exceptions:
    /*
    You can add your own exceptions by using the AHK window spy to get the Window Class that you don't want to close and adding it to the script. The window class string can be found at the 3rd line of the Window Spy, following the word "ahk_class"). If you're new to AHK, look for the section titled Exceptions in my script.  There are a bunch of if statements listing all the exceptions. Just copy one of those statements and paste it at the end of the list. Substitute the window class string at the end of the first line of the if statement you just pasted with the one you got from the AHK Window Spy. Chances are that the window class for chrome/firefox will eventually change, so you will have to adjust the exceptions as time goes on. 
    */
    
    IfInString,winclass,Shell_TrayWnd ;put_ahk_class_here
        { 
        not_an_exception:=false
        }
    IfInString,winclass,put_the_ahk_class_here
        { ; example: Chrome_WidgetWin_1 - for chrome
        not_an_exception:=false
        }
    IfInString,winclass,LaunchUnrealUWindowsClient
        { ; example: Chrome_WidgetWin_1 - for chrome
        not_an_exception:=false
        }
        
    ; End of Exceptions

if(RButton_used)
{
    ; MsgBox,,, Minimize ; for testing
    MouseGetPos,,, WinUMID
    WinActivate, ahk_id %WinUMID% ; activate window below cursor

    WinGetClass, winclass, A
   
    
    
    
    If(not_an_exception==true)
        {
         WinMinimize, ahk_id %WinUMID% 
         return
        }
        else
            {
            Suspend on
            Send {RButton down}
            Keywait, RButton, Up, L
            
            Suspend off
            }
        
}
else
{
    Suspend on
    Send {RButton down}
    Keywait, RButton, Up, L
    Suspend off
}



return

5

Re: AHK: свернуть активное окно правым кликом

Вероятно, в двух местах, где Keywait, RButton, Up, L вместо L написать T1.

6

Re: AHK: свернуть активное окно правым кликом

Flasher пишет:

Вероятно, в двух местах, где Keywait, RButton, Up, L вместо L написать T1.

все по прежнему

7

Re: AHK: свернуть активное окно правым кликом

А, ну, тогда Sleep 1000 над WinMinimize, ahk_id %WinUMID%.
Если об этом речь.