; ----------------------------------------------- #include #include #include #include #include ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_sSourceAudioPath = "F:\Audio\Source_Audio" Global $g_SetNameWave = "" Global $g_SetName = "" Global $g_TypeFolder = "" ; ----------------- Global $_MasterEdlFile = "" ; This global variable must always to be enabled! ; ----------------- Global $_sMasterType1Edl = "Type1.edl" Global $_sMasterType2Edl = "Type2.edl" Global $_sMasterType3Edl = "Type3.edl" Global $_sMasterType4Edl = "Type4.edl" ; ----------------------------------------------- Global $hGUI = GUICreate("Session|Show Development Main Menu", 225, 105) GUISetFont(14, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 3 BUTTONS Global $_sCol3Row3 = GUICtrlCreateButton("Browse Folder", 10, 10, 200, 25) Global $_sCol3Row6 = GUICtrlCreateButton("Create Type_# Data", 10, 40, 200, 25) Global $_sCol3Row9 = GUICtrlCreateButton("Exit", 10, 70, 200, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; COLUMN 3 BUTTONS Case $_sCol3Row3 _BrowseForFolder() ; Calls _MoveSourceAudioData($SetName) _LaunchWavFolder($g_SetNameWave) ; Required _CreateTextListing($g_SetNameWave) ; Required _LaunchTextListing($g_SetNameWave) ; Required Case $_sCol3Row6 _SelectWavData($g_SetName) Case $_sCol3Row9 _ExitMe() EndSwitch WEnd ; ----------------------------------------------- Func _BrowseForFolder() While 1 Local $SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") ConsoleWrite("1st: " & $SetName & @CRLF) ; ----------------------------------------------- If @error Then MsgBox($MB_TOPMOST, "NOTICE!", "No valid Type_#\Set_Name folder was selected." & @CRLF & "Please select a valid Type_#\Set_Name folder") ContinueLoop EndIf ; ----------------------------------------------- Local $_aType = StringSplit($SetName, "\") If $_aType[0] = 4 Then If $_aType[2] = "Audio" And StringRegExp($_aType[3], "Type_[1-4]") Then $g_TypeFolder = $_aType[1] & "\" & $_aType[2] & "\" & $_aType[3] $SetName = $_aType[4] ; Not required!! ;DW("$g_TypeFolder=" & $g_TypeFolder & @CRLF) ;DW("$SetName=" & $SetName & @CRLF) ; Not required!! This folder structure has been created previously. ;If Not FileExists($g_TypeFolder & "\" & $SetName & "\edl") Then DirCreate($g_TypeFolder & "\" & $SetName & "\edl") ;If Not FileExists($g_TypeFolder & "\" & $SetName & "\wav") Then DirCreate($g_TypeFolder & "\" & $SetName & "\wav") _MoveSourceAudioData($g_TypeFolder & "\" & $SetName & "\wav") ExitLoop EndIf EndIf ; ----------------------------------------------- MsgBox($MB_TOPMOST, "NOTICE!", "You must to select a valid Type_#\Set_Name folder...") WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _MoveSourceAudioData($SetName) ConsoleWrite("2nd: " & $SetName & @CRLF) FileMove($g_sSourceAudioPath & "\*.wav", $SetName, $FC_OVERWRITE) $g_SetNameWave = $SetName EndFunc ;==>_MoveSourceAudioData ; ----------------------------------------------- Func _LaunchWavFolder($SetNameWave) ;MsgBox(0, "", "The [" & $g_SetNameWave & "] global variable is being passed..." @CRLF & "...which is then being assigned to the..." & @CRLF & "...[" & $SetNameWave & "] local variable") If Not WinExists($SetNameWave) Then ShellExecute($SetNameWave) ; ----------------------------------------------- WinWaitActive($SetNameWave, "", 3) ; ----------------- WinMove($SetNameWave, "", 970, 100, 550, 650) EndFunc ;==>_LaunchWavFolder ; ----------------------------------------------- Func _CreateTextListing($SetNameWave) ;Local $MyTypeList = "" ; Assign $MyPath to $MyTypeList and create the array ;Local $MyTypeList = _FileListToArray($SetNameWave) ; ⚠ there is no file mask , cach all file ?? Local $MyTypeList = _FileListToArray($SetNameWave, "*.wav") ; ⚠ File mask...Fixed! ; ----------------------------------------------- If Not @error Then ; Create the data file _FileCreate($SetNameWave & "\FileListing.txt") ; Write the array to the data file _FileWriteFromArray($SetNameWave & "\FileListing.txt", $MyTypeList) EndIf EndFunc ;==>_CreateTextListing ; ----------------------------------------------- Func _LaunchTextListing($SetNameWave) If Not FileExists($SetNameWave & "\FileListing.txt") Then Return ; ----------------------------------------------- ShellExecute($SetNameWave & "\FileListing.txt") ; ----------------------------------------------- WinWaitActive($SetNameWave & "\FileListing.txt", "", 2) ; ----------------- WinMove($SetNameWave & "\FileListing.txt", "", 400, 100, 550, 650) EndFunc ;==>_LaunchTextListing ; ----------------------------------------------- Func _SelectWavData($SetName) ConsoleWrite("3rd: " & $SetName & @CRLF) Local $_ConfirmCreate = MsgBox($MB_YESNO, "Notice!", "Create " & StringMid($SetName, 10, 6) & " Session Data from .wav file data?") ; ----------------------------------------------- If $_ConfirmCreate = $IDYES Then Local $_WavFiles = _FileOpenDialog() Local $_DestFolder = _FileSelectFolder() Local $_sWavFolder = $_WavFiles[1] ; Contains only a path, no matter if the user has selected one or more files. ; ----------------------------------------------- For $i = 2 To $_WavFiles[0] ; First file name in element 2, and so on. Local $_WavFileName = $_sWavFolder & "\" & $_WavFiles[$i] Local $_WavBaseName = StringTrimRight($_WavFiles[$i], 4) ; ----------------- Local $_NewEdlFile = $_DestFolder & "\" & $_WavBaseName & ".edl" ; ----------------- FileCopy($_MasterEdlFile, $_NewEdlFile, $FC_NOOVERWRITE) Next ; ----------------- MsgBox($MB_ICONINFORMATION, "Success!", "The " & StringMid($SetName, 10, 6) & " Sesson .edl data file(s) have been successfully created!") ; ----------------------------------------------- Else ; $IDNO MsgBox($MB_ICONINFORMATION, "Cancelled!", "The operation was cancelled by the user.") Exit EndIf EndFunc ;==>_SelectWavData ; ----------------------------------------------- Func _FileOpenDialog() ConsoleWrite("4th: " & $SetName & @CRLF) While 1 Local $_sMessage = "Please select the required source .wav file data..." Local $_ConfirmOpenDialog = MsgBox($MB_YESNO, "Notice!", $_sMessage) ; ----------------------------------------------- If $_ConfirmOpenDialog = $IDYES Then Local $_sFileOpenDialog = FileOpenDialog($_sMessage, $SetName & "\wav", "Wave Data (*.wav)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) ; ----------------------------------------------- If @error Then MsgBox($MB_ICONINFORMATION, "Notice!", "No source .wav file data was selected!" & @CRLF & "You must select at least one source .wav file!") ContinueLoop ; While 1 EndIf ; ----------------------------------------------- Local $_WavFiles = StringSplit($_sFileOpenDialog, "|") ; ----------------------------------------------- If $_WavFiles[0] = 1 Then ; If only one file was selected by the user. Local $iPos_LastBackslash = StringInStr($_WavFiles[1], "\", 0, -1) ; -1 starts from the right (+++). ; ----------------------------------------------- ReDim $_WavFiles[3] $_WavFiles[2] = StringMid($_WavFiles[1], $iPos_LastBackslash + 1) ; The file name. $_WavFiles[1] = StringLeft($_WavFiles[1], $iPos_LastBackslash - 1) ; The path without last backslash. $_WavFiles[0] = 2 EndIf ; ----------------- Return $_WavFiles ; ----------------- Else ; $IDNO MsgBox($MB_ICONINFORMATION, "Notice!", "The operation was cancelled by the user. Exiting!") Exit EndIf WEnd EndFunc ;==>_FileOpenDialog ; ----------------------------------------------- Func _FileSelectFolder() While 1 Local $_Message = "Please select the Destination folder for the Session .edl file(s)..." Local $_ConfirmFileSelect = MsgBox($MB_YESNO, "Notice!", $_Message) ; ----------------------------------------------- If $_ConfirmFileSelect = $IDYES Then Local $_DestFolder = FileSelectFolder($_Message, $SetName) ; ----------------------------------------------- If @error Then MsgBox($MB_ICONINFORMATION, "Notice!", "No destination Session .edl folder was selected!" & @CRLF & "You must select a destination Session .edl folder!") ContinueLoop ; While 1 ; ----------------------------------------------- ElseIf StringMid($SetName, 10, 6) = "Type_1" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType1Edl ; ----------------- ElseIf StringMid($SetName, 10, 6) = "Type_2" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType2Edl ; ----------------- ElseIf StringMid($SetName, 10, 6) = "Type_3" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType3Edl ; ----------------- ElseIf StringMid($SetName, 10, 6) = "Type_4" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType4Edl ; ----------------- Else MsgBox($MB_ICONERROR, "Notice!", "The " & $_MasterEdlFile & " Session .edl file was not found.") ContinueLoop ; While 1 EndIf ; ----------------- Return $_DestFolder ; ----------------- Else ; $IDNO MsgBox($MB_ICONINFORMATION, "Notice!", "The operation was cancelled by the user. Exiting!") Exit EndIf WEnd EndFunc ;==>_FileSelectFolder ; ----------------------------------------------- Func _ExitMe() Exit EndFunc ;==>_ExitMe ; -----------------------------------------------