AutoHotkey: Double click resets the splitter: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Added category AutoHotkey scripts) |
||
Line 51: | Line 51: | ||
<BR>Back to [[AutoHotkey]]<BR> | <BR>Back to [[AutoHotkey]]<BR> | ||
[[Category:AutoHotkey scripts|Double click resets the splitter]] | |||
[[de:AutoHotkey: Starte Total Commander oder bringe sein Programmfenster in den Vordergrund]] | [[de:AutoHotkey: Starte Total Commander oder bringe sein Programmfenster in den Vordergrund]] |
Revision as of 18:52, 1 June 2008
Detect a double click on the splitter, and set it to 50%.
#IfWinActive ahk_class TTOTAL_CMD ~LButton:: ; Detect double click code: http://www.autohotkey.com/forum/viewtopic.php?p=62779#62779 Loop { LButtonDown := GetKeyState("LButton","P") If (!LButtonDown) Break } WaitTime:=DllCall( "GetDoubleClickTime" )/1000 KeyWait, LButton, D T%WaitTime% If errorlevel=0 GoSub, OnDoubleClick Return OnDoubleClick: ; Determine the splitter class name. ; Since there are more TPanel controls (the splitter is one of them), ; I use the dimensions of the controls to decide. WinGet sf_aControls, ControlList Loop Parse, sf_aControls, `n { StringLeft sf_sTemp, A_LoopField, 6 if (sf_sTemp = "TPanel") { ControlGetPos Cx,Cy,Cw,Ch, %A_LoopField% if (Cw < 16) { SplitterClass := A_LoopField Break } } } ; If the mouse is over the splitter, send cm_50Percent command. MouseGetPos, , , , ClassUnderMouse if (SplitterClass = ClassUnderMouse) { ; Wait for the left button to be released. ; This is necessary, beause if we send the cm_50Percent ; message when the button is still down, the splitter jumps back to the mouse. KeyWait LButton PostMessage 1075, 909, 0,, ahk_class TTOTAL_CMD ; cm_50Percent } Return
Back to AutoHotkey