Autohotkey
From Attie's Wiki
(Difference between revisions)
m (→Fix Explorer 'up' backspace button) |
m (Redirected page to AutoHotkey) |
||
(4 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | #REDIRECT [[AutoHotkey]] | ||
+ | |||
+ | ==Remove the tray icon== | ||
+ | <source lang="text"> | ||
+ | #NoTrayIcon | ||
+ | </source> | ||
+ | |||
+ | ==KDEstyle== | ||
+ | <code>Win + Left Mouse</code> allows you to drag a window<br> | ||
+ | <code>Win + Right Mouse</code> allows you to resize a window by the closest corner | ||
+ | <source lang="text"> | ||
+ | if (A_AhkVersion < "1.0.39.00") { | ||
+ | MsgBox,20,,This script may not work properly with your version of AutoHotkey. Continue? | ||
+ | IfMsgBox,No | ||
+ | ExitApp | ||
+ | } | ||
+ | SetWinDelay,2 | ||
+ | CoordMode,Mouse | ||
+ | return | ||
+ | |||
+ | #LButton:: | ||
+ | MouseGetPos,KDE_X1,KDE_Y1,KDE_id | ||
+ | WinGet,KDE_Win,MinMax,ahk_id %KDE_id% | ||
+ | if KDE_Win | ||
+ | return | ||
+ | WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id% | ||
+ | loop { | ||
+ | GetKeyState,KDE_Button,LButton,P | ||
+ | if KDE_Button = U | ||
+ | break | ||
+ | MouseGetPos,KDE_X2,KDE_Y2 | ||
+ | KDE_X2 -= KDE_X1 | ||
+ | KDE_Y2 -= KDE_Y1 | ||
+ | KDE_WinX2 := (KDE_WinX1 + KDE_X2) | ||
+ | KDE_WinY2 := (KDE_WinY1 + KDE_Y2) | ||
+ | WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% | ||
+ | } | ||
+ | return | ||
+ | |||
+ | #RButton:: | ||
+ | MouseGetPos,KDE_X1,KDE_Y1,KDE_id | ||
+ | WinGet,KDE_Win,MinMax,ahk_id %KDE_id% | ||
+ | if KDE_Win | ||
+ | return | ||
+ | WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% | ||
+ | if (KDE_X1 < KDE_WinX1 + KDE_WinW / 2) { | ||
+ | KDE_WinLeft := 1 | ||
+ | } else { | ||
+ | KDE_WinLeft := -1 | ||
+ | } | ||
+ | if (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2) { | ||
+ | KDE_WinUp := 1 | ||
+ | } else { | ||
+ | KDE_WinUp := -1 | ||
+ | } | ||
+ | loop { | ||
+ | GetKeyState,KDE_Button,RButton,P | ||
+ | if KDE_Button = U | ||
+ | break | ||
+ | MouseGetPos,KDE_X2,KDE_Y2 | ||
+ | WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% | ||
+ | KDE_X2 -= KDE_X1 | ||
+ | KDE_Y2 -= KDE_Y1 | ||
+ | WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2 | ||
+ | , KDE_WinY1 + (KDE_WinUp+1)/2*KDE_Y2 | ||
+ | , KDE_WinW - KDE_WinLeft *KDE_X2 | ||
+ | , KDE_WinH - KDE_WinUp *KDE_Y2 | ||
+ | KDE_X1 := (KDE_X2 + KDE_X1) | ||
+ | KDE_Y1 := (KDE_Y2 + KDE_Y1) | ||
+ | } | ||
+ | return | ||
+ | </source> | ||
+ | |||
==Fix explorer's backspace button== | ==Fix explorer's backspace button== | ||
<source lang="text"> | <source lang="text"> | ||
#IfWinActive, ahk_class CabinetWClass | #IfWinActive, ahk_class CabinetWClass | ||
Backspace:: | Backspace:: | ||
− | + | ControlGet renamestatus,Visible,,Edit1,A | |
− | + | ControlGetFocus focussed, A | |
− | + | if (renamestatus != 1 && (focussed = "DirectUIHWND3" || focussed = SysTreeView321)) { | |
− | + | SendInput {Alt Down}{Up}{Alt Up} | |
− | + | } else { | |
− | + | Send {Backspace} | |
− | + | } | |
− | + | ||
#IfWinActive | #IfWinActive | ||
</source> | </source> |
Latest revision as of 15:59, 28 January 2016
- REDIRECT AutoHotkey
[edit] Remove the tray icon
#NoTrayIcon
[edit] KDEstyle
Win + Left Mouse
allows you to drag a window
Win + Right Mouse
allows you to resize a window by the closest corner
if (A_AhkVersion < "1.0.39.00") { MsgBox,20,,This script may not work properly with your version of AutoHotkey. Continue? IfMsgBox,No ExitApp } SetWinDelay,2 CoordMode,Mouse return #LButton:: MouseGetPos,KDE_X1,KDE_Y1,KDE_id WinGet,KDE_Win,MinMax,ahk_id %KDE_id% if KDE_Win return WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id% loop { GetKeyState,KDE_Button,LButton,P if KDE_Button = U break MouseGetPos,KDE_X2,KDE_Y2 KDE_X2 -= KDE_X1 KDE_Y2 -= KDE_Y1 KDE_WinX2 := (KDE_WinX1 + KDE_X2) KDE_WinY2 := (KDE_WinY1 + KDE_Y2) WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% } return #RButton:: MouseGetPos,KDE_X1,KDE_Y1,KDE_id WinGet,KDE_Win,MinMax,ahk_id %KDE_id% if KDE_Win return WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% if (KDE_X1 < KDE_WinX1 + KDE_WinW / 2) { KDE_WinLeft := 1 } else { KDE_WinLeft := -1 } if (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2) { KDE_WinUp := 1 } else { KDE_WinUp := -1 } loop { GetKeyState,KDE_Button,RButton,P if KDE_Button = U break MouseGetPos,KDE_X2,KDE_Y2 WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id% KDE_X2 -= KDE_X1 KDE_Y2 -= KDE_Y1 WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2 , KDE_WinY1 + (KDE_WinUp+1)/2*KDE_Y2 , KDE_WinW - KDE_WinLeft *KDE_X2 , KDE_WinH - KDE_WinUp *KDE_Y2 KDE_X1 := (KDE_X2 + KDE_X1) KDE_Y1 := (KDE_Y2 + KDE_Y1) } return
[edit] Fix explorer's backspace button
#IfWinActive, ahk_class CabinetWClass Backspace:: ControlGet renamestatus,Visible,,Edit1,A ControlGetFocus focussed, A if (renamestatus != 1 && (focussed = "DirectUIHWND3" || focussed = SysTreeView321)) { SendInput {Alt Down}{Up}{Alt Up} } else { Send {Backspace} } #IfWinActive