Opt('GUIOnEventMode', 1) Opt('MustDeclareVars', 1) Opt('TrayIconDebug', 1) #include <GUIConstantsEx.au3> #Include <GuiListView.au3> #include <WindowsConstants.au3> HotKeySet('{ESC}', '_Pro_Exit'); ESC - закрыть скрипт Global Const $WM_DROPFILES = 0x0233 GUICreate('Drag Helper', 250, 250, 100, 100, $WS_OVERLAPPEDWINDOW, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST)) GUISetOnEvent($GUI_EVENT_CLOSE, '_Pro_Exit') Global $hList = GUICtrlCreateListView('Полученные файлы', 10, 10, 250-20, 200) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) _GUICtrlListView_SetColumnWidth($hList, 0, 1000) GUICtrlCreateButton('Rename', 10, 215, 70, 25) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, '_Rename') GUICtrlCreateButton('Exit', 10+70+2, 215, 70, 25) GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, '_Pro_Exit') GUICtrlCreateButton('Rename+Exit', 10+70*2+2*2, 215, 87, 25) GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT) GUICtrlSetOnEvent(-1, '_Rename_Exit') GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES') GUISetState() Func _Rename() Local $i, $sDir For $i=0 To _GUICtrlListView_GetItemCount($hList) $sDir = _GUICtrlListView_GetItemText($hList, $i) DirMove($sDir, StringRegExpReplace($sDir, '(.+\\)(.+)$', '\1' & '_\2')) _GUICtrlListView_DeleteItem($hList, $i) Next EndFunc Func _Rename_Exit() _Rename() _Pro_Exit() EndFunc Func WM_DROPFILES($hWnd, $msg, $wParam, $lParam) Local $tBuffer = DllStructCreate('char[256]') Local $iString, $sDir, $hSearch, $sFile Local $aRet = DllCall('shell32.dll', 'int', 'DragQueryFile', 'int', $wParam, 'int', -1, 'ptr', 0, 'int', 0) If $aRet[0] > 0 Then _GUICtrlListView_DeleteAllItems($hList) For $i = 0 To $aRet[0] - 1 DllCall('shell32.dll', 'int', 'DragQueryFile', 'int', $wParam, 'int', $i, 'ptr', DllStructGetPtr($tBuffer), 'int', DllStructGetSize($tBuffer)) $sDir = DllStructGetData($tBuffer, 1) If StringInStr(FileGetAttrib($sDir), 'D') Then $hSearch = FileFindFirstFile($sDir & '\*.*') If @error Then Return Dim $fFile1 = 0, $fFile2 = 0 While 1 $sFile = FileFindNextFile($hSearch) If @error Then ExitLoop If $sFile == 'cue' Then $fFile1 = 1 If $sFile == 'ape' Then $fFile2 = 1 If $sFile == 'flac' Then $fFile2 = 1 If $sFile == 'wv' Then $fFile2 = 1 WEnd FileClose($hSearch) If $fFile1 AND $fFile2 Then GUICtrlCreateListViewItem($sDir, $hList) EndIf Next DllCall('shell32.dll', 'none', 'DragFinish', 'int', $wParam) Return $GUI_RUNDEFMSG EndFunc While 1 Sleep(10) WEnd Func _Pro_Exit() Exit EndFunc |