Jump to content

_RenameTypeEdl "issues"


mr-es335
 Share

Go to solution Solved by mr-es335,

Recommended Posts

Good day,

I am attempting to write a previous script myself, just to see if I am able to do do!

I am performing all of the error checking that I am able, and thought the end result is apparently "successful" [Line 116] , I am NOT observing that end result ! "Why"

; ------------------------------------------------------
; With the assistance of...and the gratitude of...ioa747!
; Date: October 19th, 2024
; ------------------------------------------------------
#include <Array.au3>
#include <File.au3>
#include <FileConstants.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
; ------------------------------------------------------
_RenameTypeEdl()
; ------------------------------------------------------
Func _RenameTypeEdl()
    Local $confirmCreate = MsgBox(4, "NOTICE!", "Rename Type Data from .wav data?")
    ; ------------------------------------------------------
    ; For Testing purposes only! #1
    ClipPut("F:\Audio\Type_1\Test\wav")
    ;ClipPut("F:\Audio\Type_2\A\wav")
    ; ------------------------------------------------------
    If $confirmCreate = 6 Then
        Local $sourceMessage = "Select .wav data..."
        Local $sourceFolder = FileSelectFolder($sourceMessage, "F:\Audio\")
        ; ------------------------------------------------------
        ; For Testing purposes only! #2
        ; Display source folder path
        MsgBox(0, "", $sourceFolder)
        Local $_sGetTypeName = StringMid($sourceFolder, 10, 6)
        ; Display Type_# name derived from $sourceFolder #3
        MsgBox(0, "", $_sGetTypeName)
        ; ------------------------------------------------------
        If @error Then
            MsgBox($MB_ICONERROR, "NOTICE!", "No .wav folder selected. Exiting!")
            Return
        EndIf
        ; ------------------------------------------------------
        ; For Testing purposes only! #4
        ClipPut("F:\Audio\Type_1\Test\edl")
        ;ClipPut("F:\Audio\Type_2\A\edl")
        ; ------------------------------------------------------
        Local $destMessage = "Select Destination folder for the .edl files..."
        Local $destFolder = FileSelectFolder($destMessage, "F:\Audio\")
        ; ------------------------------------------------------
        ; For Testing purposes only! #5
        ; Display destination folder path
        MsgBox(0, "", $destFolder)
        ; ------------------------------------------------------
        If @error Then
            MsgBox($MB_ICONERROR, "NOTICE!", "No destination folder was selected. Exiting!")
            Return
        EndIf
        ; ------------------------------------------------------
        Local $wavFiles = _FileListToArray($sourceFolder, "*.wav", $FLTA_FILES)
        ; ------------------------------------------------------
        If @error Then
            MsgBox($MB_ICONERROR, "NOTICE", "No .wav files were found in the selected folder.")
            Return
            ; ------------------------------------------------------
            ; For Testing purposes only! #6
        Else
            ;Display the results returned by _FileListToArray.
            _ArrayDisplay($wavFiles, "$wavFiles")
        EndIf
        ; ------------------------------------------------------
        ; Note: This string is to be included!
        ; At this point the Type_# folder needs to be stored in a variable,
        ; which will be derived from the $sourceFolder variable, as shown above! See: #3
        Local $_sGetTypeName = StringMid($sourceFolder, 10, 6)
        ; ------------------------------------------------------
        ; Note: Update this string to include the previously determined "Type_# variable.
        ;Local $masterEdlFile = "G:\Session_Master\Show\Session_Data\[Var].edl"
        Local $masterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sGetTypeName & ".edl"
        ; For Testing purposes only! #5
        ; Display the result.
        MsgBox(0, "", $masterEdlFile & " #5")
        ; ------------------------------------------------------
        ; Now, based upon the above, list the path to the $masterEdlFile data file...
        If $_sGetTypeName = "Type_1" Then
            $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sGetTypeName
            MsgBox(0, "", $masterEdlFile & " #6")
            ; -----------------
        ElseIf $_sGetTypeName = "Type_2" Then
            $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sGetTypeName
            MsgBox(0, "", $masterEdlFile & " #7")
            ; -----------------
        ElseIf $_sGetTypeName = "Type_3" Then
            $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sGetTypeName
            ; -----------------
        ElseIf $_sGetTypeName = "Type_4" Then
            $_MasterEdlFile = "G:\Session_Master\Show\Session_Data\" & $_sGetTypeName
            ; ------------------------------------------------------
            ; Note: Update these strings...
            ;If Not FileExists($masterEdlFile) Then
            ;Local $_sGetTypeName = StringMid($sourceFolder, 10, 6)
        Else
            MsgBox($MB_ICONERROR, "NOTICE", "The " & $masterEdlFile & " file was not found.")
            Return
        EndIf
        ; ------------------------------------------------------
        ;MsgBox(0, "", "Am I getting to here? "Yes!")
        For $i = 1 To $wavFiles[0]
            Local $wavFileName = $wavFiles[$i]
            Local $wavBaseName = StringTrimRight($wavFileName, 4)
            ; For Testing purposes only!
            ;MsgBox(0, "", "$wavBaseName " & $wavBaseName)
            ; -----------------
            Local $newEdlFile = $destFolder & "\" & $wavBaseName & ".edl"
            ; For Testing purposes only!
            ;MsgBox(0, "", "$newEdlFile " & $newEdlFile)
            ; -----------------
            FileCopy($masterEdlFile, $newEdlFile, $FC_NOOVERWRITE)
            ; For Testing purposes only!
            MsgBox(0, "", "$newEdlFile: " & $masterEdlFile & " and " & $newEdlFile)
        Next
        ; -----------------
        MsgBox($MB_ICONINFORMATION, "Success", "All .edl files have been renamed successfully.")
        ; -----------------
    ElseIf $confirmCreate = 7 Then
        MsgBox($MB_ICONINFORMATION, "NOTICE!", "The operation was cancelled by the user.")
    EndIf
EndFunc   ;==>_RenameTypeEdl
; ------------------------------------------------------

Again, I would appreciate being told what is wrong, so that I may attempt to "fix it"!

Note: Just to be clean, it the FileCopy [Line 111] that though appearing to be successful, is not creating the destination data!

Any assistance in this matter would be greatly appreciated! Thanks!

Edited by mr-es335
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...