mr-es335 Posted 3 hours ago Share Posted 3 hours ago (edited) Good day, I have been working of a specific project over the past few months - all of which has taken me longer than anticipated...which I do sincerely believe is to be expected! At one point I also sincerely believed the project to have been successfully completed! "Surprise! Surprise!" As can be ascertained by the title, the project is entitled, "Session Show Development". Attached is an image of the "completed" project...[Image_1]. For the sake-of-simplicity, the focus of this present text will be with regards to the content as displayed in [Image_2]. With the assistance of many, in particular ioa747, I was able to resolve and issue that I was having with the ability to select incorrect paths involving the "Browse Folder" menu option. As I was investigating the initial path issues, many assisted me on various courses of action. One "solution" in particular, had to do with the employment of "global variables" - which I have always believed to be "Verboten!" However, in this particular case, it was strongly recommended that I seriously consider the employment of global variables. So, I did! However, when I was investigating the initial path issues, one of the solutions provided removed one of the global variables, which in turn affected other menu options as a result - in particular, the "Create Type_# Data" menu option. This anomaly was unforeseen on both mine and the "solution-provider's" parts, as I was only focusing on the "Browse Folder" menu option at that particular time. The Predicament! Thus, at present, I am seriously at a loss on how to resolve this present issue. To assist in a possible resolve to this present issue, I have performed the following: 1) I took the original script that employs global variables and, a) stripped down that script to the "bare essentials", and, b) renamed that script as "_WithGlobalVariables". 2) I then took the updated-and-repaired script, that employs both local and global variables and, a) stripped down that script to the "bare essentials", and, b) renamed that script as "_WithBothVariables". The titles of each of these scripts can be easily ascertained via the menu tiles as shown in [Image_3] Objectives The objective of this present issue is twofold - consisting of an "either-or" scenario, that is: 1) "Continue with employing global variables?", or 2) "Desist from employing global variables?" Attachments I have attached both of the aforementioned scripts. When perusing these scripts, please keep the following points in mind: 1) The _WithGlobalVariables: All menu options work, except when selecting a folder that is I what I refer to as "being too deep". • If you wish further information on this anomaly, please peruse the following: [Click_Me] 2) _WithBothVariables: Though I have marked the above posting as "Resolved", due to the issues that I am currently experiencing, when the script so kindly provided by ioa747 is "integrated" with the other menu options, problems do indeed arise! Again, this is no fault of ioa747, as these other menu options were not provided at the time, as I felt that such were not necessary or required. I now see that I was wrong in this assertion! As I see it.... The two key variables involved here are, 1) Global $g_SetName = ", and 2) "Global $g_SetNameWave = "". Both of these global variables get renamed to 1) $SetName and 2) $SetNameWave respectively. My initial attempt at resolve - that of changing both local variables to global, was of no success. So, I continue on... In closing... Any assistance in this matter would be greatly appreciated! As always, a sincere "thank you" for your time and attention to the above is always very much appreciated! _WithGlobalVariables.au3 _WithBothVariables.au3 Edited 3 hours ago by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
mr-es335 Posted 2 hours ago Author Share Posted 2 hours ago (edited) Good day, Step #1 I have taken the _BrowseForFolder function and added the _SelectWavData function and have determined the following: Case $_sCol3Row3 1st, $g_SetName= [Null] _BrowseForFolder 2nd, $g_SetName=F:\Audio\Type_1\AllMe _MoveSourceAudioData 3rd, $g_SetName=F:\Audio\Type_1\AllMe _LaunchWavFolder: Not employed! _CreateTextListing: Not employed! _LaunchTextListing: Not employed! _SelectWavData 4th, $g_SetName=F:\Audio\Type_1\AllMe Interestingly, the $g_SetName variable gets renamed to $g_SetNameWave in the _MoveSourceAudioData function. PS: I have attached the aforementioned script below... Step #2 Renamed: _BrowseForFolderSelectWavData to _BrowseForFolderSelectWavDatav2 Replaced $g_SetName with $SetName [46 results] and tested result Status: OK! Step #3 Renamed: _WithGlobalVariables to _WithGlobalVariablesv2 Replaced $g_SetName with $SetName [38 results] and tested result Status: OK! _BrowseForFolderSelectWavData.au3 Edited 1 hour ago by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted 1 hour ago Share Posted 1 hour ago (edited) expandcollapse popupGlobal $g_GlobalFolder = @ScriptDir & "\GlobalFolder" DirCreate($g_GlobalFolder) _Example() Func _Example() Local $sLocalFolder = @ScriptDir & "\LocalFolder" DirCreate($sLocalFolder) _OpenFolder($sLocalFolder) EndFunc ;==>_Example Func _OpenFolder($g_GlobalFolder) ConsoleWrite("$g_GlobalFolder=" & $g_GlobalFolder & @CRLF) ShellExecute($g_GlobalFolder) EndFunc ;==>_OpenFolder #cs What do I mean by this example? If you want the _OpenFolder function to go to $g_GlobalFolder, it would be better to omit the $g_GlobalFolder parameter from the _OpenFolder function. This is because the function can access the global variable directly without having to pass it as a parameter. Func _OpenFolder() ShellExecute($g_GlobalFolder) EndFunc If you keep the parameter in the _OpenFolder function, it can lead to confusion, and it can make it difficult to keep track of the variable referred to in the function, especially if $g_GlobalFolder is referred to multiple times. Alternatively, change the name of the parameter to e.g. $Folder Func _OpenFolder($Folder) ShellExecute($Folder) EndFunc #CE If this makes any sense Edited 1 hour ago by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted 55 minutes ago Share Posted 55 minutes ago (edited) In real life in _WithGlobalVariables.au3 e.g. expandcollapse popupCase $_sCol3Row3 _BrowseForFolder() _LaunchWavFolder($g_SetNameWave) _CreateTextListing($g_SetNameWave) _LaunchTextListing($g_SetNameWave) ... ... ... 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 It would be clearer and easier to read. expandcollapse popupCase $_sCol3Row3 _BrowseForFolder() _LaunchWavFolder() _CreateTextListing() _LaunchTextListing() ... ... ... Func _LaunchWavFolder() ShellExecute($g_SetNameWave) ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($g_SetNameWave, "", 970, 100, 550, 650) EndFunc ;==>_LaunchWavFolder Func _CreateTextListing() 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() ShellExecute($g_SetNameWave & "\FileListing.txt") ; ----------------------------------------------- Sleep(250) ; ----------------------------------------------- WinMove($g_SetNameWave & "\FileListing.txt", "", 400, 100, 550, 650) ; ----------------------------------------------- EndFunc ;==>_LaunchTextListing and it wouldn't change anything in the flow of the script Edited 53 minutes ago by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
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