; Set environment.
SetBatchLines, -1
SetControlDelay, -1
DetectHiddenWindows, On
SetWorkingDir, %A_ScriptDir%
; Build main GUI.
GoSub, Gui_Build_Main
Return ; End of auto-execute section.
Gui_Build_Main:
{
; Build GUI.
Gui, Margin, 3, 5
Gui, Add, Text , xm ym w50 h20 Right 0x200 , Folder #1:
Gui, Add, Edit , xm+55 ym w270 h20 vFolder_1 ,
Gui, Add, Button , xm+330 ym w30 h20 vBrowse_1 gBrowse, ...
Gui, Add, Text , xm ym+25 w50 h20 Right 0x200 , Folder #2:
Gui, Add, Edit , xm+55 ym+25 w270 h20 vFolder_2 ,
Gui, Add, Button , xm+330 ym+25 w30 h20 vBrowse_2 gBrowse, ...
Gui, Add
, Button
, xm
+170 ym
+53 w190 h25 vDelete gDelete
, &Delete matching files
to Recycle Bin
Gui, Add, Statusbar
SB_SetText( "Ready.", 1 )
GUI_ID := WinExist()
Gui, Show, AutoSize Center, Match & Recycle
}
GuiEscape:
GuiClose:
{
ExitApp
}
Delete:
{
Gui, 1: Submit, NoHide
; Basic pre-check.
If ( Folder_1
= "" OR Folder_2
= "" OR ! FileExist
( Folder_1
) OR ! FileExist
( Folder_2
) ) {
}
Loop, % Folder_1 . "\*.*", 0, 0
{
SB_SetText( "Processing: " . A_LoopFileName, 1 )
If FileExist
( Folder_2
. "\" . A_LoopFileName ) {
}
}
SB_SetText( "Done.", 1 )
}
Browse:
{
Gui, 1: Submit, NoHide
If ( A_GuiControl
= "Browse_1" ) {
Folder_1 := ""
{
GuiControl, Text, Folder_1, % Folder_1
}
}
Else If ( A_GuiControl
= "Browse_2" ) {
Folder_2 := ""
{
GuiControl, Text, Folder_2, % Folder_2
}
}
; Right justify the edit control's content if longer than the control's length
SendMessage, 0xB1, 500, 500, Edit1 ; 0xB1 is EM_SETSEL
SendMessage, 0xB1, 500, 500, Edit2 ; 0xB1 is EM_SETSEL
}