To Enable "Drag Lock" (after making a file selection):
Press LButton (hold), Press RButton (down/up) ... LButton can now be physically released.
To cancel "Drag Lock"
1) Press ESC, or
2) Press LButton (hold), Press RButton (down/up)
No Change in Behaviour:
When you want to "Drop" the files, Click as usual ---
Or press & Hold RButton before Clicking to turn into a move.
Behaviour retained from the original script:
1) The Scroll Wheel affects the file panel (or tree) that the mouse is currently hovering over.
2) Pressing "Space" when "Drag Lock" is enabled, or the Mouse Cursor has changed to indicate a Drag&Drop operation, will open the Tree Panel and move the mouse cursor to that location.
Note: As with normal TC behaviour
1) Enter can be used on folders that the mouse pointer has activated to open them.
2) Files can be dropped anywhere. Tabs, BreadCrumb, Panels, Folders, etc.
Code: Select all
;;
;; TC_DragDropLock.ahk v1.20
;;
;; Balderstrom, Jan.2011
;;
#SingleInstance, Force
#Persistent
#NoEnv
SetBatchLInes, -1
SendMode Input
return
#ifWinActive, ahk_class TTOTAL_CMD
{
$Space::
{
if( DragFileState || (GetKeyState("LButton", "P") && inStr(",50135657,155189883,162595327,337117793,", "," QueryMouseCursor() ",")))
{
DragFileState:=1
SendMessage, 0x433, 3200, 0,, A ; cm_SeparateTreeOFF
SendMessage, 0x433, 3201, 0,, A ; cm_SeparateTree1
MouseMove, 50, 100
}
else
Send, {Space}
return
}
WheelUp::
WheelDown::
{
if( !DragFileState )
{
Send, % "{" A_ThisHotKey "}"
return
}
MouseGetPos,,,,aConID,3
ControlClick,, ahk_id %aConID%,,% A_ThisHotKey
return
}
$LButton::
{
if( DragFileState )
{
KeyWait, LButton
if( !DragFileState )
return
Send, {LButton Up}
TimerDFS(-1)
return
}
else
Send, {LButton Down}
return
}
$LButton Up::Send, % (DragFileState ? "" : "{LButton Up}")
$RButton::
{
if( GetKeyState("LButton", "P"))
TimerDFS( DragFileState:=!DragFileState )
else
if( DragFileState )
{
; Send, {Enter} ; Version 1.20 - removed.
MouseGetPos,,,,aConID,3 ; Version 1.20 test.
ControlSend,, {Enter}, ahk_id %aConID% ; Version 1.20 test.
}
else
Send, {RButton Down}
return
}
$RButton Up::Send, {RButton Up}
$ESC::
{
if( DragFileState )
TimerDFS( 0 )
else
Send, {ESC}
return
}
/*
$Enter::
$NumPadEnter::
{
if( !DragFileState )
Send, % A_ThisHotkey
else
{ ; Version 1.20
MouseGetPos,,,,aConID,3 ; Version 1.20
ControlSend,, {Enter}, ahk_id %aConID% ; Version 1.20
}
return
}
*/
return
}
ToolTipDFS:
ToolTip, % " Drag File State: ON"
return
TimerDFS(onOFF)
{
Global DragFileState
if( onOFF == 1 )
SetTimer, ToolTipDFS, 250
else
{
DragFileState:=0
SetTimer, ToolTipDFS, OFF
ToolTip
if( onOFF <> -1 )
{
Send, {ESC}
MsgBox,,,Drag File State: OFF,1
}
}
return
}
QueryMouseCursor()
{
VarSetCapacity(CurrentCursorStruct, 20, 0)
NumPut( 20, CurrentCursorStruct, 0 )
result := DllCall("GetCursorInfo", "str", CurrentCursorStruct)
return (NumGet(CurrentCursorStruct, 8))
}