Added the option to quickly navigate to the folder using the context menu on the icon, also made the icon abit bigger.
;DropFolder.ahk
; Drop files on a floating icon to move or copy files to user defined folders
; Press Ctrl while dropping to copy files
;Skrommel+Justice
#NoEnv
#SingleInstance,Force
SetWindelay,0
paths=C:\temp,C:
picture=icon.jpg
transparency=150
x=100
y=100
w=64
h=64
location=AlwaysOnTop
Gosub,EXPLOREMENU
Gosub,MENU
OnMessage(0x112,"WM_SYSCOMMAND")
If location=AlwaysOnTop
guioptions:="+" location
If w<>
pictureoptions:="H-1 W" w
Else
pictureoptions:="W-1 H" h
Gui,Margin,0,0
Gui,% "-Caption +ToolWindow +LastFound -Resize " guioptions
guiid:=WinExist()
Gui,Add,Picture,% pictureoptions " GMOVEWINDOW",% picture
Gui,Show,% "X" x " Y" y
WinSet,Transparent,% transparency
Return
GuiDropFiles:
GetKeyState,ctrl,Control,P
where:=A_GuiControl
filecount:=A_EventInfo
guix:=A_GuiX
guiy:=A_GuiY
files:=A_GuiEvent
Menu,menu,Show
Return
GuiContextMenu:
where:=A_GuiControl
filecount:=A_EventInfo
guix:=A_GuiX
guiy:=A_GuiY
files:=A_GuiEvent
Menu,Explore,Show
Return
EXPLOREMENU:
Loop,Parse,paths,`,
Menu,Explore,Add,% A_LoopField,EXPLORE
Menu,Explore,Add
Menu,Explore,Add,&Browse...,EXPLOREBROWSE
Menu,Explore,Add,&Cancel,CANCEL
return
MENU:
Loop,Parse,paths,`,
Menu,menu,Add,% A_LoopField,COPY
Menu,menu,Add
Menu,menu,Add,&Browse...,BROWSE
Menu,menu,Add,&Cancel,CANCEL
Return
EXPLORE:
run,%A_ThisMenuItem%
return
EXPLOREBROWSE:
FileSelectFolder,target,,3
If target=
Return
Run,%target%
return
COPY:
FileCreateDir,%A_ThisMenuItem%
If ctrl=D
Loop,Parse,files,`n
FileCopy,%A_LoopField%,%A_ThisMenuItem%
Else
Loop,Parse,files,`n
FileMove,%A_LoopField%,%A_ThisMenuItem%
Return
BROWSE:
FileSelectFolder,target,,3
If target=
Return
FileCreateDir,%target%
If ctrl=D
Loop,Parse,files,`n
FileCopy,%A_LoopField%,%target%
Else
Loop,Parse,files,`n
FileMove,%A_LoopField%,%target%
Return
CANCEL:
Return
;Stolen from SKAN at http://www.autohotkey.com/forum/topic32768.html
MOVEWINDOW:
PostMessage,0xA1,2,,,A ;WM_NCLBUTTONDOWN=0x00A1 HTCAPTION=2
Return
;Stolen from Lexicos at http://www.autohotkey.com/forum/topic18260.html
WM_SYSCOMMAND(wParam)
{
Global guiid
If (A_Gui && wParam = 0xF020) ; SC_MINIMIZE
WinRestore,ahk_id %guiid%
}
GuiClose:
ExitApp
edit: fixed seperator