; ----------------------------------------------- #include #include #include #include ; ----------------------------------------------- Global $WorkingDir="E:\Master_Backup" Global $DestinationDir='G:\Session_Master\Performance' ; ----------------------------------------------- $hMain=GUICreate('Session List Producer', 645, 265) $cSessionlist=GUICtrlCreateListView('Current Session Files Listing', 100, 10, 400, 235, 0x0008, 0x00000020) ; LVS_SHOWSELALWAYS, LVS_EX_FULLROWSELECT $cAdd=GUICtrlCreateButton('Add', 10, 10, 80, 25) $cRemove=GUICtrlCreateButton('Remove', 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) $cExit=GUICtrlCreateButton('Exit', 10, 190, 80, 25) $cAbout=GUICtrlCreateButton('About', 10, 220, 80, 25) _GUICtrlListView_SetColumnWidth($cSessionlist, 0, 400) ; Contol the width of the listview columns GUISetState(@SW_SHOW, $hMain) $Pic1=GUICtrlCreatePic("D:\Install\System_Data\Images\bg_b_img.bmp", 511, 10, 125, 237) ; ----------------------------------------------- While True Switch GUIGetMsg() Case $cAdd AddToSessionList($cSessionlist) Case $cRemove RemoveFromSessionList($cSessionlist) Case $cCopy CopyFiles($cSessionlist) Case $cClear ClearSessionList($cSessionlist) Case $cSave SaveSessionList($cSessionlist) Case $cOpen OpenSessionList($cSessionlist) Case $cExit Exit Case -3 ; GUI_EVENT_CLOSE ExitLoop Case $cAbout AboutSessionList() EndSwitch WEnd ; ----------------------------------------------- Func AddToSessionList($cSessionlist) Local $iItem Local $sFileSelectDialog=FileOpenDialog('Select Session 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($cSessionlist, $aSplit[1], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1], $cSessionlist) Else MsgBox(0x40, 'Info!!', $aSplit[1] & ' is already in the Session Listing.') ; MB_ICONINFORMATION EndIf Else _GUICtrlListView_BeginUpdate($cSessionlist) For $Index=2 To $aSplit[0] $iItem= _GUICtrlListView_FindText($cSessionlist, $aSplit[1] & '\' & $aSplit[$Index], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1] & '\' & $aSplit[$Index], $cSessionlist) Else MsgBox(0x40, 'Info!', $aSplit[1] & '\' & $aSplit[$Index] & ' is already in the Session Listing.') ; MB_ICONINFORMATION EndIf Next _GUICtrlListView_EndUpdate($cSessionlist) EndIf EndFunc ; ----------------------------------------------- Func RemoveFromSessionList($cSessionlist) Local $iRet=MsgBox(0x24, 'Remove Listing', 'Do you want to remove the selected file(s)?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteItemsSelected($cSessionlist) ; IDYES EndFunc ; ----------------------------------------------- Func CopyFiles($cSessionlist) 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($cSessionlist) For $Index=0 To $iCount - 1 FileCopy(_GUICtrlListView_GetItemText($cSessionlist, $Index), $sDestination) Next MsgBox(0x40, 'Operation done', 'The files from Session Listing has been copied to ' & $sDestination) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func ClearSessionList($cSessionlist) Local $iRet=MsgBox(0x24, 'Clear', 'Do you want to clear the Session Listing?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteAllItems($cSessionlist) ; IDYES EndFunc ; ----------------------------------------------- Func SaveSessionList($cSessionlist) Local $sSave=FileSaveDialog('Save Session Listing', $DestinationDir, 'Session List (*.ini)', 18) ; FD_PATHMUSTEXIST + FD_PROMPTOVERWRITE If @error Then Return SetError(1, 0, Null) If StringRight($sSave, 4) <> '.ini' Then $sSave &= '.ini' Local $hFile=FileOpen($sSave, 2) ; FO_OVERWRITE Local $iCount=_GUICtrlListView_GetItemCount($cSessionlist) For $Index=0 To $iCount - 1 FileWriteLine($hFile, _GUICtrlListView_GetItemText($cSessionlist, $Index)) Next FileClose($hFile) MsgBox(0x40, 'Save Session Listing', 'The Session Listing has been sucessfully saved to...' & $sSave) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func OpenSessionList($cSessionlist) Local $sLoad=FileOpenDialog('Open Session List', $DestinationDir, 'Session List (*.ini)', 1) ; FD_FILEMUSTEXIST If @error Then Return SetError(1, 0, Null) Local $sSessionList=StringStripWS(FileRead($sLoad), 3) ; STR_STRIPLEADING + STR_STRIPTRAILING _GUICtrlListView_BeginUpdate($cSessionlist) _GUICtrlListView_DeleteAllItems($cSessionlist) Local $aLine=StringSplit($sSessionList, @CRLF, 1) If IsArray($aLine) Then For $Index=1 To $aLine[0] GUICtrlCreateListViewItem($aLine[$Index], $cSessionlist) Next EndIf _GUICtrlListView_EndUpdate($cSessionlist) MsgBox(0x40, 'Copy completed!', 'The Session Listing ' & $sLoad & ' has been sucessfully copied to...' & $sSave) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func AboutSessionList() ;MsgBox($MB_SYSTEMMODAL, "NOTICE!!", "Function currently in progress...", 3) Msgbox(64,'About!', 'Session List Producer'&@CRLF& _ ''&@crlf& _ 'Original concept by Dell Krauchi'&@crlf& _ ''&@crlf& _ 'From [Playlist Maker] by ragnarok775'&@crlf& _ ''&@crlf& _ 'Updated script by Andreik'&@crlf& _ '') EndFunc ; -----------------------------------------------