-
1 Ataşament(e)
Middle Mouse Button
Fiind un mare fan Firefox, m-am abisnuit sa inchid tab-urile cu ajutorul butonului din mijloc al mouse-ului.
Poate din comoditate, as fi dorit sa pot inchide si aplicatiile din Taskbar tot in acelasi mod (folosesc un Win XP).
Asa ca am gasit aceasta aplicatie si folosind acest script:
Cod:
MButton::
SetBatchLines, -1
CoordMode, Mouse, Screen
SetMouseDelay, -1 ; no pause after mouse clicks
SetKeyDelay, -1 ; no pause after keys sent
MouseGetPos, ClickX, ClickY, WindowUnderMouseID
WinActivate, ahk_id %WindowUnderMouseID%
; WM_NCHITTEST
SendMessage, 0x84,, ( ClickY << 16 )|ClickX,, ahk_id %WindowUnderMouseID%
WM_NCHITTEST_Result =%ErrorLevel%
/*
#define HTERROR (-2)
#define HTTRANSPARENT (-1)
#define HTNOWHERE 0
#define HTCLIENT 1
#define HTCAPTION 2
#define HTSYSMENU 3
#define HTGROWBOX 4
#define HTSIZE HTGROWBOX
#define HTMENU 5
#define HTHSCROLL 6
#define HTVSCROLL 7
#define HTMINBUTTON 8
#define HTMAXBUTTON 9
#define HTLEFT 10
#define HTRIGHT 11
#define HTTOP 12
#define HTTOPLEFT 13
#define HTTOPRIGHT 14
#define HTBOTTOM 15
#define HTBOTTOMLEFT 16
#define HTBOTTOMRIGHT 17
#define HTBORDER 18
#define HTREDUCE HTMINBUTTON
#define HTZOOM HTMAXBUTTON
#define HTSIZEFIRST HTLEFT
#define HTSIZELAST HTBOTTOMRIGHT
#if(WINVER >= 0x0400)
#define HTOBJECT 19
#define HTCLOSE 20
#define HTHELP 21
*/
; Close window with titlebar click
If WM_NCHITTEST_Result in 2,3,8,9,20,21 ; in titlebar enclosed area - top of window
{
PostMessage, 0x112, 0xF060,,, ahk_id %WindowUnderMouseID% ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
Return
}
; Close taskbar program click
IfWinActive, ahk_class Shell_TrayWnd
{
MouseClick, Right, %ClickX%, %ClickY%
Sleep, 50
Send, c
WinWaitNotActive, ahk_class Shell_TrayWnd,, 0.5 ; wait for save dialog, etc
If ErrorLevel =1
Send, !{Tab}
Return
}
; Open IE link in new window
IfWinActive, ahk_class IEFrame ; going to click on a link to open in new window
{
If A_Cursor =Unknown ; pointer is probably the Hand icon (for links)
{
StatusBarGetText, IEStatusBarText, 1
StringLeft, IEStatusBarText, IEStatusBarText, 4
If IEStatusBarText = java ; javascript - should open in its own new window anyhow
{
Click, %ClickX%, %ClickY%
SetTimer, OpenIELinkInNewWindowSleep, 400 ; new thread
}
Else
{
Send +{Click %ClickX%, %ClickY%} ; Shift+LeftClick
SetTimer, OpenIELinkInNewWindowSleep, 400 ; new thread
}
Return
}
}
; else send normal middle click
If GetKeyState("MButton", "P") ; The middle button is physically down
MouseClick, Middle, %ClickX%, %ClickY%,, Down
Else
MouseClick, Middle, %ClickX%, %ClickY%
Return
OpenIELinkInNewWindowSleep: ; if still holding middle mouse down, returns to original window
SetTimer, OpenIELinkInNewWindowSleep, Off
WinWaitNotActive, ahk_id %WindowUnderMouseID%,, 1
Sleep, 100
WinMaximize, A
If GetKeyState("MButton", "P") ; The middle button is physically down
WinActivate ahk_id %WindowUnderMouseID%
Return
am generat un executabil ce ruleaza in system tray si face exact acest lucru.
Pentru cei care vor sa utilizeze asa ceva am pus si fisierul generat.