mr-es335 Posted October 28, 2023 Posted October 28, 2023 Good day, The following works...but as can be observed...the script is rather "clumsy".. expandcollapse popup; ----------------------------------------------- #include <FileConstants.au3> #include <FontConstants.au3> #include <GUIConstantsEx.au3> ; ----------------------------------------------- ; SECTION A: Select the Session .elds ; Note: The total .edls is anywhere from 1 to 16 Local Const $sMessage1="Select .edl file" Local $SRC1="E:\Master_Backup\Type_1" Local $sFileOpenDialog1=FileOpenDialog($sMessage1, $SRC1, "Session File (*.edl)", BitOr($FD_FILEMUSTEXIST, $FD_MULTISELECT)) ; ----------------- Local Const $sMessage2="Select .edl file" Local $SRC2="E:\Master_Backup\Type_1" Local $sFileOpenDialog2=FileOpenDialog($sMessage2, $SRC2, "Session File (*.edl)", BitOr($FD_FILEMUSTEXIST, $FD_MULTISELECT)) ; ----------------------------------------------- Local Const $sMessage3="Select .edl file" Local $SRC3="E:\Master_Backup\Type_1" Local $sFileOpenDialog3=FileOpenDialog($sMessage3, $SRC3, "Session File (*.edl)", BitOr($FD_FILEMUSTEXIST, $FD_MULTISELECT)) ; ----------------------------------------------- ; ----------------------------------------------- Local $_Selected_Folder=("G:\Session_Master\Performance") ; ----------------------------------------------- ; ----------------------------------------------- ; SECTION B: Select the Session .elds CopyFiles($sFileOpenDialog1, $_Selected_Folder) CopyFiles($sFileOpenDialog2, $_Selected_Folder) CopyFiles($sFileOpenDialog3, $_Selected_Folder) ; ----------------------------------------------- ; SECTION C: This section is working - Many thanks to Andreik!! Func CopyFiles($sFileOpenDialog, $sDestination) If StringInStr($sFileOpenDialog, "|") Then Local $aFileSplit=StringSplit($sFileOpenDialog, "|") For $i=3 To $aFileSplit[0] FileCopy($aFileSplit[1] & "\" & $aFileSplit[$i], $sDestination) Next Else FileCopy($sFileOpenDialog, $sDestination) EndIf EndFunc ; ----------------------------------------------- As can be observed, SECTION A and SECTION B have similar "repeated sections" - just not too sure how to impalement this? mr-es335 Sentinel Music Studios
Andreik Posted October 28, 2023 Posted October 28, 2023 (edited) expandcollapse popup; ----------------------------------------------- #include <FileConstants.au3> #include <FontConstants.au3> #include <GUIConstantsEx.au3> ; ----------------------------------------------- Local $aFileOpenDialog[3] Local $aTypes[3][3] = _ [ _ ["Select .edl file", "E:\Master_Backup\Type_1", "Session File (*.edl)"], _ ["Select .edl file", "E:\Master_Backup\Type_1", "Session File (*.edl)"], _ ["Select .edl file", "E:\Master_Backup\Type_1", "Session File (*.edl)"] _ ] For $Index = 0 To UBound($aTypes, 0) - 1 $aFileOpenDialog[$Index] = FileOpenDialog($aTypes[$Index][0], $aTypes[$Index][1], $aTypes[$Index][2], BitOr($FD_FILEMUSTEXIST, $FD_MULTISELECT)) Next ; ----------------------------------------------- Local $_Selected_Folder=("G:\Session_Master\Performance") ; ----------------------------------------------- ; ----------------------------------------------- ; SECTION B: Select the Session .elds For $Index = 0 To UBound($aFileOpenDialog) - 1 CopyFiles($aFileOpenDialog[$Index], $_Selected_Folder) Next ; ----------------------------------------------- ; SECTION C: This section is working - Many thanks to Andreik!! Func CopyFiles($sFileOpenDialog, $sDestination) If StringInStr($sFileOpenDialog, "|") Then Local $aFileSplit=StringSplit($sFileOpenDialog, "|") For $i=3 To $aFileSplit[0] FileCopy($aFileSplit[1] & "\" & $aFileSplit[$i], $sDestination) Next Else FileCopy($sFileOpenDialog, $sDestination) EndIf EndFunc ; ----------------------------------------------- Â Edited October 28, 2023 by Andreik
mr-es335 Posted October 29, 2023 Author Posted October 29, 2023 (edited) Good day, Here is the scenario: There is a single "type" directory [Type_1] This directory contains various sub-directories [Artist's name] Each sub-directories could contain any number of data files The minimum number of data files to select is 1 The maximum number of data files to select is 16 The above script that I have provided permits a maximum of 3 files to be selected. And though I could repeat the routine in SECTION A, there must be more efficient means of doing so. Lastly , the means of being able to exit the file selection process at any time would also need to be provided if less than 16 files are to be selected. I do hope that this makes sense? Edited October 29, 2023 by mr-es335 Updates mr-es335 Sentinel Music Studios
Andreik Posted October 29, 2023 Posted October 29, 2023 12 minutes ago, mr-es335 said: There are 6 "type" folders What do you mean by 6 types of folders? I suppose that we talk about file types, not directories.
mr-es335 Posted October 29, 2023 Author Posted October 29, 2023 (edited) Andreik, Note: Please peruse the original posting as I have updated that posting. I use the terms "folder" and "directories" interchangeably...folders=Windows parlance, directories=command-line parlance. The other 5 directories are similar...just different types of audio content. However, I will only be accessing one directory at a time. Once I am in the Type_1 directory, I will then need to be able to navigate to any of the other sub-directories until all data files have been selected - up to and including 16. Have a peep at the attached... Edited October 29, 2023 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted October 29, 2023 Author Posted October 29, 2023 (edited) Good day, To save oneself from "recreating the wheel"...I thought of audio playlists. Though the data that I am currently working with is not an audio file directly, this data is still audio-related. As a result, I came across this little tid-bit, [Playlist Maker] This script provides many of the features that i am looking for...with some modifications required to meet my particular needs...of course. Many thanks to ragnarok775 for his efforts in providing this work! Edited October 29, 2023 by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted October 29, 2023 Author Posted October 29, 2023 (edited) Good day, So...with some slight modifications...here is what have thus far... expandcollapse popup; ----------------------------------------------- #include <GUIConstantsEx.au3> #include <ListboxConstants.au3> #Include <GuiListBox.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <String.au3> ; ----------------------------------------------- Opt('MustDeclareVars', 1) ; ---------------- Global $guictrl[8] Global $files[200] Global $arraypos = 0 Global $last_selected Global $name = "session.edl" Global $WorkingDir="E:\Master_Backup" ; ----------------------------------------------- _main() ; ----------------------------------------------- Func _main() Local $msg Local $title = "Performance Creator" GUICreate($title, 700, 233) GUISetFont(7.5) GUISetState(@SW_SHOW) $guictrl[0] = GUICtrlCreateButton("Add ", 10, 10, 45) $guictrl[1] = GUICtrlCreateList("", 65, 10, 625, 225, BitOR($WS_HSCROLL, $WS_VSCROLL, $LBS_EXTENDEDSEL)) $guictrl[3] = GUICtrlCreateButton("Delete ", 10, 40, 45) $guictrl[6] = GUICtrlCreateButton("Clear", 10, 70, 45) $guictrl[7] = GUICtrlCreateButton("Copy", 10, 100, 45) ; ADDED GUICtrlSetFont($guictrl[1], 8.5, "", "", "Calibri") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $guictrl[0] _OpenDialog() Case $msg = $guictrl[3] _Delete() Case $msg = $guictrl[6] _ClearArray() Case $msg = $guictrl[7] _Copy() EndSelect WEnd GUIDelete() EndFunc ; ----------------------------------------------- ; REMOVED ;Func _Import() ; ----------------------------------------------- ; AN IMPORTANT FUNCTION HERE!! Func _OpenDialog() Local $odfile Local $pos Local $i = 1 Local $k = 0 Local $temp[200] Local $skip = 0 $odfile = FileOpenDialog("Select edl Files", $WorkingDir, "Session File (*.edl)", 4) If @error Then Return If StringInStr($odfile, "|") Then $temp = StringSplit($odfile, "|") While $i < $temp[0] $skip = 0 While $k < $arraypos If $temp[1] & "\" & $temp[$i + 1] = $files[$k] Then MsgBox(0, "", '"' & $temp[$i + 1] & '" is allready in the library') $skip = 1 EndIf $k += 1 WEnd $k = 0 If $skip = 0 Then $files[$arraypos] = $temp[1] & "\" & $temp[$i + 1] $arraypos += 1 EndIf $i += 1 WEnd Else While $k < $arraypos If $odfile = $files[$k] Then MsgBox(0, "", '"' & $odfile & '" is allready in the library') $skip = 1 EndIf $k += 1 WEnd $k = 0 If $skip = 0 Then $files[$arraypos] = $odfile $arraypos += 1 EndIf EndIf _UpdateList() EndFunc ; ----------------------------------------------- Func _UpdateList() Local $i Local $strlen Local $horiz_fit Local $max_len = 0 GUICtrlSetData($guictrl[1], "") While $i < $arraypos GUICtrlSetData($guictrl[1], $files[$i]) $strlen = StringLen($files[$i]) If $strlen > 88 Then If $strlen > $max_len Then $max_len = $strlen EndIf EndIf $i += 1 WEnd $horiz_fit = Round($max_len * 7.08) _GUICtrlListBox_SetHorizontalExtent($guictrl[1], $horiz_fit) _GUICtrlListBox_SetSel($guictrl[1], $last_selected) EndFunc ; ----------------------------------------------- ; REMOVED, but could be useful later for saving a Performance Listings ;Func _Save(ByRef $title) ; ----------------------------------------------- Func _ClearArray() Local $i Local $clear $clear = MsgBox(276, "Clear playlist?", "Are you sure you want to clear your playlist?") If $clear = 6 Then Else Return EndIf GUICtrlSetData($guictrl[1], "") While $i < $arraypos $files[$i] = "" $i += 1 WEnd $last_selected = "" $arraypos = 0 EndFunc ; ----------------------------------------------- Func _Delete() Local $i = 0 Local $k = 0 Local $temp $temp = GUICtrlRead($guictrl[1]) While $i < $arraypos If $temp = $files[$i] Then $files[$i] = "" $k = $i While $k < $arraypos $files[$k] = $files[$k + 1] $k += 1 WEnd $arraypos -= 1 $last_selected = $i _UpdateList() Return EndIf $i += 1 WEnd EndFunc ; ----------------------------------------------- Func _Copy() ; ADDED MsgBox($MB_SYSTEMMODAL, "NOTICE!!", "Function currently in progress...", 3) EndFunc ; ----------------------------------------------- ; ALL REMOVED ;Func _MoveUp() ;Func _MoveDown() ;Func _Swap($pos1, $pos2) ;Func _ArDisplay() All that is required is the means of being able to copy the selected data obtained from either the "Func _OpenDialog()" function or the "Func _UpdateList()" function. Just not to such which one? Any assistance one could provide would be greatly appreciated!! Â Â Edited October 29, 2023 by mr-es335 mr-es335 Sentinel Music Studios
Andreik Posted October 29, 2023 Posted October 29, 2023 (edited) 19 hours ago, mr-es335 said: Andreik, Note: Please peruse the original posting as I have updated that posting. I use the terms "folder" and "directories" interchangeably...folders=Windows parlance, directories=command-line parlance. The other 5 directories are similar...just different types of audio content. However, I will only be accessing one directory at a time. Once I am in the Type_1 directory, I will then need to be able to navigate to any of the other sub-directories until all data files have been selected - up to and including 16. Have a peep at the attached... Comparing this with your last post I am really confuse because these are completely different request. What question should we answer now? If you are still looking to achieve a playlist system, here is a simple example: expandcollapse popup#include <GuiListView.au3> Global $WorkingDir = "E:\Master_Backup" ; Change this with your desired directory Global $DestinationDir = 'E:\Master_Backup' ; Change this with your desired directory $hMain = GUICreate('Playlist', 900, 600) $cPlaylist = GUICtrlCreateListView('File', 100, 10, 790, 580, 0x0008, 0x00000020) ; LVS_SHOWSELALWAYS, LVS_EX_FULLROWSELECT $cAdd = GUICtrlCreateButton('Add', 10, 10, 80, 30) $cDelete = GUICtrlCreateButton('Delete', 10, 50, 80, 30) $cCopy = GUICtrlCreateButton('Copy', 10, 90, 80, 30) $cClear = GUICtrlCreateButton('Clear', 10, 130, 80, 30) _GUICtrlListView_SetColumnWidth($cPlaylist, 0, 760) GUISetState(@SW_SHOW, $hMain) While True Switch GUIGetMsg() Case $cAdd AddToPlaylist($cPlaylist) Case $cDelete DeleteFromPlaylist($cPlaylist) Case $cCopy CopyFiles($cPlaylist) Case $cClear ClearPlaylist($cPlaylist) Case -3 ; GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func AddToPlaylist($cPlaylist) Local $iItem Local $sFileSelectDialog = FileOpenDialog('Select 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($cPlaylist, $aSplit[1], -1, False) If $iItem = -1 Then GUICtrlCreateListViewItem($aSplit[1], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Else _GUICtrlListView_BeginUpdate($cPlaylist) For $Index = 2 To $aSplit[0] $iItem = _GUICtrlListView_FindText($cPlaylist, $aSplit[1] & '\' & $aSplit[$Index], -1, False) If $iItem = -1 Then GUICtrlCreateListViewItem($aSplit[1] & '\' & $aSplit[$Index], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & '\' & $aSplit[$Index] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Next _GUICtrlListView_EndUpdate($cPlaylist) EndIf EndFunc Func DeleteFromPlaylist($cPlaylist) Local $iRet = MsgBox(0x24, 'Delete', 'Do you want to delete the selected files?') ; MB_YESNO + MB_ICONQUESTION If $iRet = 6 Then _GUICtrlListView_DeleteItemsSelected($cPlaylist) ; IDYES EndFunc Func CopyFiles($cPlaylist) 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($cPlaylist) For $Index = 0 To $iCount - 1 FileCopy(_GUICtrlListView_GetItemText($cPlaylist, $Index), $sDestination) Next MsgBox(0x40, 'Operation done', 'The files from playlist has been copied to ' & $sDestination) ; MB_ICONINFORMATION EndFunc Func ClearPlaylist($cPlaylist) Local $iRet = MsgBox(0x24, 'Clear', 'Do you want to clear the playlist?') ; MB_YESNO + MB_ICONQUESTION If $iRet = 6 Then _GUICtrlListView_DeleteAllItems($cPlaylist) ; IDYES EndFunc  Edited October 29, 2023 by Andreik mr-es335 1
Solution mr-es335 Posted October 29, 2023 Author Solution Posted October 29, 2023 (edited) Andreik, "WOW!!, "Double WOW! and "WOW! WOW! WOW!" - you get the idea!! What can I say? As i taught my children to say [all 7 of them], "Thank you, thank you, thank you...not enough Thank you's!" I gather that the script provided by ragnarok775 was of some assistance... 1 hour ago, Andreik said: Comparing this with your last post I am really confuse because these are completely different request. What question should we answer now? My sincere apologies for this,...so forgive me. And in answer your last question...none! • I must admit, Andreik, that i was indeed "unclear" as to my original intent...but when I though t of "playlists" - it was the very clear exactly what I was hoping to achieve. Along with the most excellent "copy" function" you have provided - ass is working as I have expected. So again, Andreik..."Thank you!" "A teacher takes a hand, opens a mind, and touches a heart." Edited October 29, 2023 by mr-es335 Andreik 1 mr-es335 Sentinel Music Studios
mr-es335 Posted October 29, 2023 Author Posted October 29, 2023 (edited) Good day, The following is an an update... Andreik-Before Func additions.au3 Added: 1) Save option [ Not yet implemented] 2) Open open [ Not yet implemented] The following is working with both of the above - but is the version as provided by ragnarok775: Sample 4.au3 The two functions as provided by ragnarok775: Func _Import().au3 Func _Save(ByRef $title).au3 ...just need to figure out how to "marry" the two together...with the version as provided by Andreik... Edited October 30, 2023 by mr-es335 mr-es335 Sentinel Music Studios
Andreik Posted October 30, 2023 Posted October 30, 2023 Here is a basic implementation to save/load playlists: expandcollapse popup; ----------------------------------------------- #include <GuiListView.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Global $WorkingDir="E:\Master_Backup" Global $DestinationDir='G:\Session_Master\Performance' Global $PlaylistsDir = @DesktopDir ; Update it with desired directory path ; ----------------------------------------------- $hMain=GUICreate('Playlist', 500, 250) $cPlaylist=GUICtrlCreateListView('Session Files Listing', 100, 10, 425, 225, 0x0008, 0x00000020) ; LVS_SHOWSELALWAYS, LVS_EX_FULLROWSELECT $cAdd=GUICtrlCreateButton('Add', 10, 10, 80, 25) $cDelete=GUICtrlCreateButton('Delete', 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) _GUICtrlListView_SetColumnWidth($cPlaylist, 0, 400) GUISetState(@SW_SHOW, $hMain) ; ----------------------------------------------- While True Switch GUIGetMsg() Case $cAdd AddToPlaylist($cPlaylist) Case $cDelete DeleteFromPlaylist($cPlaylist) Case $cCopy CopyFiles($cPlaylist) Case $cClear ClearPlaylist($cPlaylist) Case $cSave SavePerf($cPlaylist) Case $cOpen OpenPerf($cPlaylist) Case -3 ; GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; ----------------------------------------------- Func AddToPlaylist($cPlaylist) Local $iItem Local $sFileSelectDialog=FileOpenDialog('Select files', $WorkingDir, 'EDL Files (*txt)', 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($cPlaylist, $aSplit[1], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Else _GUICtrlListView_BeginUpdate($cPlaylist) For $Index=2 To $aSplit[0] $iItem= _GUICtrlListView_FindText($cPlaylist, $aSplit[1] & '\' & $aSplit[$Index], -1, False) If $iItem=-1 Then GUICtrlCreateListViewItem($aSplit[1] & '\' & $aSplit[$Index], $cPlaylist) Else MsgBox(0x40, 'Info', $aSplit[1] & '\' & $aSplit[$Index] & ' is already in the playlist.') ; MB_ICONINFORMATION EndIf Next _GUICtrlListView_EndUpdate($cPlaylist) EndIf EndFunc ; ----------------------------------------------- Func DeleteFromPlaylist($cPlaylist) Local $iRet=MsgBox(0x24, 'Delete', 'Do you want to delete the selected files?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteItemsSelected($cPlaylist) ; IDYES EndFunc ; ----------------------------------------------- Func CopyFiles($cPlaylist) 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($cPlaylist) For $Index=0 To $iCount - 1 FileCopy(_GUICtrlListView_GetItemText($cPlaylist, $Index), $sDestination) Next MsgBox(0x40, 'Operation done', 'The files from playlist has been copied to ' & $sDestination) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func ClearPlaylist($cPlaylist) Local $iRet=MsgBox(0x24, 'Clear', 'Do you want to clear the playlist?') ; MB_YESNO + MB_ICONQUESTION If $iRet=6 Then _GUICtrlListView_DeleteAllItems($cPlaylist) ; IDYES EndFunc ; ----------------------------------------------- Func SavePerf($cPlaylist) Local $sSave = FileSaveDialog('Save playlist', $PlaylistsDir, 'Playlist (*.mr5)', 18) ; FD_PATHMUSTEXIST + FD_PROMPTOVERWRITE If @error Then Return SetError(1, 0, Null) If StringRight($sSave, 4) <> '.mr5' Then $sSave &= '.mr5' Local $hFile = FileOpen($sSave, 2) ; FO_OVERWRITE Local $iCount=_GUICtrlListView_GetItemCount($cPlaylist) For $Index=0 To $iCount - 1 FileWriteLine($hFile, _GUICtrlListView_GetItemText($cPlaylist, $Index)) Next FileClose($hFile) MsgBox(0x40, 'Operation done', 'The playlist has been saved to ' & $sSave) ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Func OpenPerf($cPlaylist) Local $sLoad = FileOpenDialog('Open playlist', $PlaylistsDir, 'Playlist (*.mr5)', 1) ; FD_FILEMUSTEXIST If @error Then Return SetError(1, 0, Null) Local $sPlaylist = StringStripWS(FileRead($sLoad), 3) ; STR_STRIPLEADING + STR_STRIPTRAILING _GUICtrlListView_BeginUpdate($cPlaylist) _GUICtrlListView_DeleteAllItems($cPlaylist) Local $aLine = StringSplit($sPlaylist, @CRLF, 1) If IsArray($aLine) Then For $Index = 1 To $aLine[0] GUICtrlCreateListViewItem($aLine[$Index], $cPlaylist) Next EndIf _GUICtrlListView_EndUpdate($cPlaylist) MsgBox(0x40, 'Operation done', 'The playlist ' & $sLoad & ' has been loaded.') ; MB_ICONINFORMATION EndFunc ; ----------------------------------------------- Â mr-es335 1
mr-es335 Posted October 30, 2023 Author Posted October 30, 2023 Solved...Double solved...and even Triple solved!! mr-es335 Sentinel Music Studios
mr-es335 Posted October 30, 2023 Author Posted October 30, 2023 (edited) Good day, Â Well,..with the assistance of ragnarok775 and Anreik, the script is now completed... Here is the completed script... Session_List_Producer.au3 Again...many, many thanks to both ragnarok775 and Anreik...and especially to Anreik!! Very much appreciated... Edited October 30, 2023 by mr-es335 Updates Andreik 1 mr-es335 Sentinel Music Studios
Andreik Posted October 30, 2023 Posted October 30, 2023 User interface looks neat but the script doesn't run properly because the variable $sSave is used in OpenSessionList() but it was never declared as global or in the context of this function. 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) ; This line will cause an error EndFunc A quick fix would be to declare it as a global variable, along with other global variables, and in SaveSessionList() function just remove the local scope of the variable and everything will work properly. Global $sSave Global $WorkingDir="E:\Master_Backup" Global $DestinationDir='G:\Session_Master\Performance' Func SaveSessionList($cSessionlist) $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 Â
mr-es335 Posted October 30, 2023 Author Posted October 30, 2023 Andreik, Hmmm...I thought that I had checked everything...but obviously "NOT"! Thanks for the clarification....updated! mr-es335 Sentinel Music Studios
mr-es335 Posted November 7, 2023 Author Posted November 7, 2023 Andriek, I have noticed that the backup routine is not overwriting the destination files...and I am not sure why. I thought that I knew how to "fix it"...but, alas "No!" I have stripped out the routine and made that routine a standalone - simply for testing purposes. Bup_Session_Data.au3 Any idea why? Thanks! The provided test-script DOES work however. test_script.au3  mr-es335 Sentinel Music Studios
mr-es335 Posted November 7, 2023 Author Posted November 7, 2023 (edited) Andriek, You stated, "Third parameter of FileCopy() function should be $FC_OVERWRITE if you want to overwrite the existing files." Yes, I DO know this...however I did not obtain satisfactory results! Following is just the updated portion of the script: Func CopyFiles($sFileOpenDialog, $sDestination) If StringInStr($sFileOpenDialog, "|") Then Local $aFileSplit = StringSplit($sFileOpenDialog, "|") For $i = 2 To $aFileSplit[0] FileCopy($aFileSplit[1] & "\" & $aFileSplit[$i], $sDestination, $FC_OVERWRITE) Next Else FileCopy($sFileOpenDialog, $sDestination, $FC_OVERWRITE) EndIf EndFunc Is the above then...correct? UPDATE!: I have checked and double-checked the above and all is functioning as it should! Edited November 8, 2023 by mr-es335 Updates 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