mr-es335 Posted November 26 Author Posted November 26 (edited) Melba, I was employing the example as that which is provided in the HelpfFIle... Edited November 26 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted November 26 Author Posted November 26 Good day, As noted, I have updated the "Solution" status on ioa747's script. Below is my updated offering: expandcollapse popup; ----------------------------------------------- #include <File.au3> #include <FileConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_sSourceAudioPath = "F:\Audio\Source_Audio" Global $g_SetNameWave = "" Global $g_SetName = "" Global $g_TypeFolder = "" ; ----------------------------------------------- Global $hGUI = GUICreate("Session|Show Development Main Menu", 225, 165) GUISetFont(14, 800, 0, "Calibri") ; ----------------------------------------------- ; COLUMN 3 BUTTONS Global $_sCol3Row3 = GUICtrlCreateButton("Browse Folder", 10, 10, 200, 25) Global $_sCol3Row4 = GUICtrlCreateButton("Enter Set Name", 10, 40, 200, 25) Global $_sCol3Row5 = GUICtrlCreateButton("Launch TAC", 10, 70, 200, 25) Global $_sCol3Row6 = GUICtrlCreateButton("Create Type_# Data", 10, 100, 200, 25) Global $_sCol3Row9 = GUICtrlCreateButton("Exit", 10, 130, 200, 25) ; ----------------------------------------------- GUISetState(@SW_SHOW, $hGUI) ; ----------------------------------------------- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit ; COLUMN 3 BUTTONS Case $_sCol3Row3 _BrowseForFolder() ; Calls _MoveSourceAudioData($g_SetName) _LaunchWavFolder($g_SetNameWave) ; Required _CreateTextListing($g_SetNameWave) ; Required _LaunchTextListing($g_SetNameWave) ; Required Case $_sCol3Row9 _ExitMe() EndSwitch WEnd ; ----------------------------------------------- Func _BrowseForFolder() While 1 Local $SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") ; ----------------------------------------------- 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] $g_SetName = $_aType[4] ; Not required!! ;DW("$g_TypeFolder=" & $g_TypeFolder & @CRLF) ;DW("$g_SetName=" & $g_SetName & @CRLF) ; Not required!! This folder structure has been created previously. ;If Not FileExists($g_TypeFolder & "\" & $g_SetName & "\edl") Then DirCreate($g_TypeFolder & "\" & $g_SetName & "\edl") ;If Not FileExists($g_TypeFolder & "\" & $g_SetName & "\wav") Then DirCreate($g_TypeFolder & "\" & $g_SetName & "\wav") _MoveSourceAudioData($g_TypeFolder & "\" & $g_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) 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 _ExitMe() Exit EndFunc ;==>_ExitMe ; ----------------------------------------------- mr-es335 Sentinel Music Studios
mr-es335 Posted November 28 Author Posted November 28 (edited) AndrewG, Launching your offering, gets me nowhere... See here #1 See here #2 Note the following: The root folder is always: F:\Audio\ The path F:\Audio\Type_1\AllMe is to be the only selection At present, I am able to select F:\Audio\Type_1\AllMe\wav which produces an error. • The path F:\Audio\Type_1\AllMe\wav is what I refer to as, being "...too deep". Edited November 28 by mr-es335 mr-es335 Sentinel Music Studios
pixelsearch Posted November 28 Posted November 28 @mr-es335 now that you're working with a longer path (F:\Audio\Type_1\AllMe\wav) , does this modified line in Andrew's code solves your "too deep" issue ? ; Case $_aGetType[0] < 3 Or $_aGetType[0] > 3 Case $_aGetType[0] <> 4
mr-es335 Posted November 28 Author Posted November 28 pixelsearch, Sorry...no this does not... mr-es335 Sentinel Music Studios
pixelsearch Posted November 28 Posted November 28 (edited) That's very unlucky for you, because when I run Andrew"s script with the single line change mentioned above, all works fine for me, e.g. 1) If I select the folder F:\Audio\Type_1\AllMe , then everything is ok 2) If I select a "too short" folder (F:\Audio\Type_1) or a "too deep" folder (F:\Audio\Type_1\AllMe\wav) then the error message appears and I have to cycle again to select the correct folder. I really wonder why it's not working for you with the reworked Andrew's script (pasted below for convenience, only 1 line is modified), especially you got the correct path F:\Audio\Type_1\AllMe\wav expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $g_SetName = "" Global $hGUI = GUICreate("_WithGlobalVariables", 225, 165) GUISetFont(14, 800, 0, "Calibri") Global $_sCol3Row3 = GUICtrlCreateButton("Browse Folder", 10, 10, 200, 25) GUISetState(@SW_SHOW, $hGUI) Global $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $_sCol3Row3 _BrowseForFolder() EndSwitch WEnd Func _BrowseForFolder() Local $MyComputerCLSID = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", $MyComputerCLSID) ; ----------------------------------------------- If @error Then Local $iRetMsgBox_Notice_1 = MsgBox($MB_OKCANCEL, "NOTICE! (1)", "No valid Type_#\Set_Name folder was selected." & @CRLF & "Please select a valid Type_#\Set_Name folder", 0, $hGUI) Select Case $iRetMsgBox_Notice_1 = 2 ;Cancel button ExitLoop Case $iRetMsgBox_Notice_1 = 1 ;OK button ContinueLoop EndSelect EndIf ; ----------------------------------------------- Local $_aGetType = StringSplit($g_SetName, "\") ; ----------------------------------------------- Select ; Case $_aGetType[0] < 3 Or $_aGetType[0] > 3 Case $_aGetType[0] <> 4 ; <====================================== Local $iRetMsgBox_Notice_2 = MsgBox($MB_OKCANCEL, "NOTICE! (2)", "You must select a valid Type_#\Set_Name folder...", 0, $hGUI) Select Case $iRetMsgBox_Notice_2 = 2 ;Cancel button ExitLoop Case $iRetMsgBox_Notice_2 = 1 ;OK button ContinueLoop EndSelect Case $_aGetType[3] = "Type_1" ;~ _MoveSourceAudioData($g_SetName) MsgBox(0, "Message", "Selected folder: " & $_aGetType[3], 0, $hGUI) ExitLoop Case $_aGetType[3] = "Type_2" ;~ _MoveSourceAudioData($g_SetName) MsgBox(0, "Message", "Selected folder: " & $_aGetType[3], 0, $hGUI) ExitLoop EndSelect WEnd Return EndFunc ;==>_BrowseForFolder Edited November 28 by pixelsearch typo
mr-es335 Posted November 28 Author Posted November 28 pixelsearch, Then there MUST be a path error somewhere. I get absolute nowhere with this! mr-es335 Sentinel Music Studios
mr-es335 Posted November 28 Author Posted November 28 (edited) Good day, Well! I do believe that I have solved it!!! Here is the script: expandcollapse popup; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_SetName = "" ; ----------------------------------------------- _BrowseForFolder() ; ----------------------------------------------- Func _BrowseForFolder() While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($g_SetName & "\wav") ; ----------------------------------------------- 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" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf 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 _MoveSourceAudioData($g_SetName) MsgBox($MB_TOPMOST, "NOTICE!", "Made it to _MoveSourceAudioData...with..." & $g_SetName) EndFunc ;==>_MoveSourceAudioData ; ----------------------------------------------- Here is the outline... Quote Path Outline Root\Type\Setname\SubFolder We have: Designation Description Result The Root = F:\Audio\ Wrong! The Type = Type_1 Wrong! The SetName = [Varies] Correct! The SubFolder = [edl\wav] Wrong! The procedure [A] Launch: script Select: Root = F:\Audio\ Error! Select: OK Select: Type_1 > Select Folder Error! Select: SetName > Select Folder Select: OK Observation: The _MoveSourceAudioData is executed! Select: OK Done! The procedure Launch: script Select: Root\Type\Setname\SubFolder [edl] Select: Select Folder Error! Select: Root\Type\Setname\SubFolder [wav] Select: Select Folder Error! Select: Root\Type\Setname Select: Select Folder Select: OK Observation: The _MoveSourceAudioData is executed! Select: OK Done! Any "other" path other than "Root\Type\Setname" - produces and error! Which is precisely what I had wanted and asked for in the first place! Please confirm! It would be greatly appreciated! Edited November 28 by mr-es335 mr-es335 Sentinel Music Studios
pixelsearch Posted November 29 Posted November 29 Great ! You made it work because you're checking if there is a \wav subfolder that exists just under the folder selected by the user. Just watch out with this line : Local $iFileExists = FileExists($g_SetName & "\wav") You placed it here : $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($g_SetName & "\wav") If @error Then Which means that the @error checking that you were correctly doing just after FileSelectFolder doesn't mean anything now because of the inserted line, e.g. @error won't be related to FileSelectFolder anymore. Good luck
mr-es335 Posted November 29 Author Posted November 29 (edited) pixelsearch, Thanks for the heads-up...appreciated! I can remove that section, as it is not longer required. It would "appear" that my "fix" has corrected a number of issues!! In fact, I just discovered, that I can remove the following two sections: expandcollapse popup; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_SetName = "" ; ----------------------------------------------- _BrowseForFolder() ; ----------------------------------------------- Func _BrowseForFolder() While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($g_SetName & "\wav") ; ----------------------------------------------- ;If @error Then <<<<THIS CAN BE REMOVED! ; 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" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf Case $_aGetType[3] = "Type_2" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf ;Case Else <<<<THIS CAN BE REMOVED! ; MsgBox($MB_TOPMOST, "NOTICE!", "You must to select a valid Type_#\Set_Name folder...") ; ContinueLoop EndSelect WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _MoveSourceAudioData($g_SetName) MsgBox($MB_TOPMOST, "NOTICE!", "Made it to _MoveSourceAudioData...with..." & $g_SetName) EndFunc ;==>_MoveSourceAudioData ; ----------------------------------------------- Edited November 29 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted November 29 Author Posted November 29 (edited) Good day one-and-all! Well, after a number of weeks and many, many hours of head-scratching, I do sincerely believe that I have the complected function "all ready to go!" Here is that completed function: ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_SetName = "" ; ----------------------------------------------- _BrowseForFolder() ; ----------------------------------------------- Func _BrowseForFolder() While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($g_SetName & "\wav") ; ----------------------------------------------- If StringRegExp($g_SetName & "\", "\\Type_[1-4]\\") Then If $iFileExists Then _MoveSourceAudioData($g_SetName) ExitLoop EndIf Else MsgBox($MB_TOPMOST, "NOTICE!", "You must to select a valid Type_#\Set_Name folder...") EndIf WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _MoveSourceAudioData($g_SetName) MsgBox($MB_TOPMOST, "NOTICE!", "Made it to _MoveSourceAudioData...with..." & @CRLF & " ..." & $g_SetName & "...as the \wav path!") EndFunc ;==>_MoveSourceAudioData ; ----------------------------------------------- Many thanks to iooa747 for his continued support of my efforts! Also, ioa747 was instrumental in reducing the overall script as well. Thank for this!! Though the original project [Click_Me] does indeed employ a number of global variables, this function does not make me have to alter the existing project in anyway whatsoever...as many of the suggestion here did! And where did I obtain the source for this particular revelation? The HelpFile! • Why I never looked into this in the first place, I may never know! But I am sure glad that I did!! Here is a sampling of my initial efforts...that eventually led to the "fix": ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Example() ; ----------------------------------------------- Func Example() Local $sFilePath = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($sFilePath & "\wav") ; ----------------------------------------------- If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _IAmOutOfHere() Else MsgBox($MB_SYSTEMMODAL, "", "The file does not exist...try again...") Example() EndIf EndFunc ;==>Example ; ----------------------------------------------- Func _IAmOutOfHere() MsgBox($MB_SYSTEMMODAL, "", "Inside _IAmOutOfHere!") EndFunc ;==>_IAmOutOfHere ; ----------------------------------------------- So, in closing... A heartfelt "Thank you" to all who provided assistance in this present endeavor! Your efforts are very much appreciated! Edited November 29 by mr-es335 mr-es335 Sentinel Music Studios
ioa747 Posted November 29 Posted November 29 (edited) Func _MoveSourceAudioData($g_SetName) expandcollapse popup; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- Global $g_SetName = "" ; ----------------------------------------------- _BrowseForFolder() ; ----------------------------------------------- Func _BrowseForFolder() While 1 $g_SetName = FileSelectFolder("Please select a valid Type_#\Set_Name folder...", "F:\Audio\") Local $iFileExists = FileExists($g_SetName & "\wav") ; ----------------------------------------------- ;If @error Then <<<<THIS CAN BE REMOVED! ; 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, "\") ; ----------------------------------------------- #cs before: Select Case $_aGetType[0] < 3 MsgBox($MB_TOPMOST, "NOTICE!", "You must select a valid Type_#\Set_Name folder...") ContinueLoop Case $_aGetType[3] = "Type_1" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf Case $_aGetType[3] = "Type_2" ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData($g_SetName) ExitLoop EndIf ;Case Else <<<<THIS CAN BE REMOVED! ; MsgBox($MB_TOPMOST, "NOTICE!", "You must to select a valid Type_#\Set_Name folder...") ; ContinueLoop EndSelect #CE If $_aGetType[0] < 3 Then MsgBox($MB_TOPMOST, "NOTICE!", "You must select a valid Type_#\Set_Name folder...") ContinueLoop EndIf If $_aGetType[3] = "Type_1" Or $_aGetType[3] = "Type_2" Then ConsoleWrite("" & $_aGetType[3] & @CRLF) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists....continue...") _MoveSourceAudioData() ExitLoop EndIf EndIf WEnd EndFunc ;==>_BrowseForFolder ; ----------------------------------------------- Func _MoveSourceAudioData() MsgBox($MB_TOPMOST, "NOTICE!", "Made it to _MoveSourceAudioData...with..." & $g_SetName & "\wav") ; ⚠ & "\wav" is missing ?? EndFunc ;==>_MoveSourceAudioData ; ----------------------------------------------- Edited November 29 by ioa747 mr-es335 1 I know that I know nothing
mr-es335 Posted November 29 Author Posted November 29 ioa747, Being extremely "procedural-minded", the removal of all global arguments, is on my list of "To Do's"! I will keep you all apprised of my progress. PS: What do you think of my resolve? I would appreciate your comments|suggestions! mr-es335 Sentinel Music Studios
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now