; ----------------------------------------------- #include #include #include #include #include #include ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_sSourceAudioPath = "F:\Audio\Source_Audio" Global $g_SetNameWave = "" Global $g_SetName = "" ; ----------------- 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("_WithGlobalVariables", 220, 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 ConsoleWrite("1st, $g_SetName= [Null]" & $g_SetName & @CRLF) _BrowseForFolder() ;_LaunchWavFolder($g_SetNameWave) ;_CreateTextListing($g_SetNameWave) ;_LaunchTextListing($g_SetNameWave) Case $_sCol3Row6 _SelectWavData($g_SetName) Case $_sCol3Row9 _ExitMe() EndSwitch WEnd ; ----------------------------------------------- ; GLOBAL FUNCTIONS Func _MoveSourceAudioData($g_SetName) ConsoleWrite("3rd, $g_SetName=" & $g_SetName & @CRLF) While 1 Select Case StringMid($g_SetName, 10, 6) = "Type_1" FileMove($g_sSourceAudioPath & "\*.*", $g_SetName & "\wav", $FC_OVERWRITE) $g_SetNameWave = $g_SetName & "\wav" ExitLoop Case StringMid($g_SetName, 10, 6) = "Type_2" FileMove($g_sSourceAudioPath & "\*.*", $g_SetName & "\wav", $FC_OVERWRITE) $g_SetNameWave = $g_SetName & "\wav" ExitLoop EndSelect WEnd EndFunc ;==>_MoveSourceAudioData ; ----------------------------------------------- Func _LaunchWavFolder($g_SetNameWave) ShellExecute($g_SetNameWave) ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($g_SetNameWave, "", 970, 100, 550, 650) EndFunc ;==>_LaunchWavFolder ; ----------------------------------------------- Func _CreateTextListing($g_SetNameWave) Local $MyT1List = '' ; ----------------------------------------------- ; Assign $MyPath to $MyT1List and create the array $MyT1List = _FileListToArray($g_SetNameWave) ; Create the data file _FileCreate($g_SetNameWave & "\FileListing.txt") ; Write the array to the data file _FileWriteFromArray($g_SetNameWave & "\FileListing.txt", $MyT1List) EndFunc ;==>_CreateTextListing ; ----------------------------------------------- Func _LaunchTextListing($g_SetNameWave) ShellExecute($g_SetNameWave & "\FileListing.txt") ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($g_SetNameWave & "\FileListing.txt", "", 400, 100, 550, 650) ; ----------------------------------------------- EndFunc ;==>_LaunchTextListing ; ----------------------------------------------- ;COLUMN 3 BUTTONS Func _BrowseForFolder() While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") ConsoleWrite("2nd, $g_SetName=" & $g_SetName & @CRLF) ; ----------------------------------------------- If @error Then MsgBox($MB_TOPMOST, "", "No valid Type_#\Set_Name folder was selected." & @CRLF & "Please select a valid Type_#\Set_Name folder") ContinueLoop EndIf ; ----------------------------------------------- Local $_aGetType = StringSplit($g_SetName, "\") ; ----------------------------------------------- Select Case $_aGetType[0] < 3 MsgBox($MB_TOPMOST, "NOTICE!", "You must select a valid Type_#\Set_Name folder...") ContinueLoop Case $_aGetType[3] = "Type_1" _MoveSourceAudioData($g_SetName) ExitLoop Case $_aGetType[3] = "Type_2" _MoveSourceAudioData($g_SetName) ExitLoop Case Else MsgBox($MB_TOPMOST, "NOTICE!", "You must to select a valid Type_#\Set_Name folder...") ContinueLoop EndSelect WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _SelectWavData($g_SetName) ConsoleWrite("4th, $g_SetName=" & $g_SetName & @CRLF) Local $_ConfirmCreate = MsgBox($MB_YESNO, "Notice!", "Create " & StringMid($g_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($g_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() 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, $g_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, $g_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($g_SetName, 10, 6) = "Type_1" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType1Edl ; ----------------- ElseIf StringMid($g_SetName, 10, 6) = "Type_2" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType2Edl ; ----------------- ElseIf StringMid($g_SetName, 10, 6) = "Type_3" Then $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sMasterType3Edl ; ----------------- ElseIf StringMid($g_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 ; -----------------------------------------------