; ----------------------------------------------- #include #include ; ----------------------------------------------- Global $WorkingDir="E:\Master_Backup" Global $DestinationDir='G:\Session_Master\Performance' ; ----------------------------------------------- $hMain=GUICreate('Playlist', 500, 250) $cPlaylist=GUICtrlCreateListView('Session Files Listing', 100, 10, 425, 225, 0x0008, 0x00000020) ; LVS_SHOWSELALWAYS, LVS_EX_FULLROWSELECT $cAdd=GUICtrlCreateButton('Add', 10, 10, 80, 25) $cDelete=GUICtrlCreateButton('Delete', 10, 40, 80, 25) $cCopy=GUICtrlCreateButton('Copy', 10, 70, 80, 25) $cClear=GUICtrlCreateButton('Clear', 10, 100, 80, 25) $cSave=GUICtrlCreateButton('Save', 10, 130, 80, 25) $cOpen=GUICtrlCreateButton('Open', 10, 160, 80, 25) _GUICtrlListView_SetColumnWidth($cPlaylist, 0, 400) GUISetState(@SW_SHOW, $hMain) ; ----------------------------------------------- While True Switch GUIGetMsg() Case $cAdd AddToPlaylist($cPlaylist) Case $cDelete DeleteFromPlaylist($cPlaylist) Case $cCopy CopyFiles($cPlaylist) Case $cClear ClearPlaylist($cPlaylist) Case $cSave SavePerf($cPlaylist) Case $cOpen OpenPerf($cPlaylist) Case -3 ; GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; ----------------------------------------------- Func AddToPlaylist($cPlaylist) Local $iItem Local $sFileSelectDialog=FileOpenDialog('Select files', $WorkingDir, 'EDL Files (*.edl)', 4) ; FD_MULTISELECT If @error Then Return SetError(1, 0, Null) Local $aSplit=StringSplit($sFileSelectDialog, '|') If Not IsArray($aSplit) Then Return SetError(1, 0, Null) If $aSplit[0]=1 Then $iItem=_GUICtrlListView_FindText($cPlaylist, $aSplit[1], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Else _GUICtrlListView_BeginUpdate($cPlaylist) For $Index=2 To $aSplit[0] $iItem= _GUICtrlListView_FindText($cPlaylist, $aSplit[1] & '\' & $aSplit[$Index], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1] & '\' & $aSplit[$Index], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & '\' & $aSplit[$Index] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Next _GUICtrlListView_EndUpdate($cPlaylist) EndIf EndFunc ; ----------------------------------------------- Func DeleteFromPlaylist($cPlaylist) Local $iRet=MsgBox(0x24, 'Delete', 'Do you want to delete the selected files?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteItemsSelected($cPlaylist) ; IDYES EndFunc ; ----------------------------------------------- Func CopyFiles($cPlaylist) Local $sDestination=FileSelectFolder('Select destination', $DestinationDir) If @error Then MsgBox(0x30, 'Warning', 'Destination directory has not been selected.' & @CRLF & 'Operation is canceled.') ; MB_ICONWARNING Return SetError(1, 0, Null) EndIf Local $iCount=_GUICtrlListView_GetItemCount($cPlaylist) For $Index=0 To $iCount - 1 FileCopy(_GUICtrlListView_GetItemText($cPlaylist, $Index), $sDestination) Next MsgBox(0x40, 'Operation done', 'The files from playlist has been copied to ' & $sDestination) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func ClearPlaylist($cPlaylist) Local $iRet=MsgBox(0x24, 'Clear', 'Do you want to clear the playlist?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteAllItems($cPlaylist) ; IDYES EndFunc ; ----------------------------------------------- Func SavePerf($cPlaylist) MsgBox($MB_SYSTEMMODAL, "NOTICE!!", "Function currently in progress...", 3) EndFunc ; ----------------------------------------------- Func OpenPerf($cPlaylist) MsgBox($MB_SYSTEMMODAL, "NOTICE!!", "Function currently in progress...", 3) EndFunc ; -----------------------------------------------