mr-es335 Posted July 27 Share Posted July 27 (edited) Good day, I hope that the day finds you well! Is there any way to simplify a multiple folder|file search to be displayed n a MsgBox? The following is what I am employing at the moment, but this example is rather time-consuming: expandcollapse popup; ----------------------------------------------- Func _CheckIfSrcDataExists() ; ------------------------------------------------ ; Source data Local $sProgramFilesCommonFilesFolder = "C:\Program Files\Common Files\Native Instruments" Local $sProgramFilesFolder = "C:\Program Files\Native Instruments" Local $sAmpsimFolder = "C:\RML\SAC\VST_PlugIns\Ampsim" Local $sAmpsimIniFilePath = "C:\RML\SAC\VST_PlugIns\Ampsim.ini" Local $sAppDataFolderPath = "C:\Users\Dell\AppData\Local\Native Instruments" Local $sQuickLaunchFilePath = "C:\Users\Dell\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Guitar Rig 5.lnk" Local $sSystem32_1FilePath = "C:\Windows\System32\msvcp120.dll" Local $sSystem32_2FilePath = "C:\Windows\System32\msvcr120.dll" Local $sWOW64_1FilePath = "C:\Windows\SysWOW64\msvcp120.dll" Local $sWOW64_2FilePath = "C:\Windows\SysWOW64\msvcr120.dll" Local $sTextFolderPath = "E:\Text\Native Instruments" ; ------------------------------------------------ If FileExists($sProgramFilesCommonFilesFolder) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sProgramFilesCommonFilesFolder & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sProgramFilesCommonFilesFolder & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sProgramFilesFolder) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sProgramFilesFolder & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sProgramFilesFolder & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sAmpsimFolder) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sAmpsimFolder & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sAmpsimFolder & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sAmpsimIniFilePath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sAmpsimIniFilePath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sAmpsimIniFilePath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sAppDataFolderPath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sAppDataFolderPath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sAppDataFolderPath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sQuickLaunchFilePath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sQuickLaunchFilePath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sQuickLaunchFilePath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sSystem32_1FilePath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sSystem32_1FilePath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sSystem32_1FilePath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sSystem32_2FilePath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sSystem32_2FilePath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sSystem32_2FilePath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sWOW64_1FilePath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sWOW64_1FilePath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sWOW64_1FilePath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sWOW64_2FilePath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sWOW64_2FilePath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sWOW64_2FilePath & " ...does not exist!", 2) EndIf ; ---------------- If FileExists($sTextFolderPath) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sTextFolderPath & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $sTextFolderPath & " ...does not exist!", 2) EndIf ; ---------------- EndFunc ;==>_CheckIfSrcDataExists ; ------------------------------------------------ As can be observed, there IS a considerable amount of redundancy here! I would like to display the results in a MsgBox: MsgBox(64, 'Results!', _ $sProgramFilesCommonFilesFolder & @CRLF & _ $sProgramFilesFolder & @CRLF & _ $sProgramDataTemp_1Folder & @CRLF & _ $sProgramDataTemp_2Folder & @CRLF & _ : and so on... ") Any assistance in this matter would be greatly appreciated! Edited July 27 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Nine Posted July 27 Share Posted July 27 (edited) Not exactly sure what you are asking but there you go : #include <Array.au3> #include <Constants.au3> #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) ; since some files/folder are in windows folder Local $sResult = CheckIfSrcDataExists() MsgBox($MB_SYSTEMMODAL, "Results!", $sResult) Func CheckIfSrcDataExists() Local $aPath[] = ["C:\Program Files\Common Files\Native Instruments", _ "C:\Program Files\Native Instruments", _ "C:\RML\SAC\VST_PlugIns\Ampsim", _ "C:\RML\SAC\VST_PlugIns\Ampsim.ini", _ "C:\Users\Dell\AppData\Local\Native Instruments", _ "C:\Users\Dell\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Guitar Rig 5.lnk", _ "C:\Windows\System32\msvcp120.dll", _ "C:\Windows\System32\msvcr120.dll", _ "C:\Windows\SysWOW64\msvcp120.dll", _ "C:\Windows\SysWOW64\msvcr120.dll", _ "E:\Text\Native Instruments"] For $i = 0 To UBound($aPath) - 1 If FileExists($aPath[$i]) Then MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $aPath[$i] & " ...does exist!", 2) Else MsgBox($MB_SYSTEMMODAL, "Confirm if Folder|Data Exists", $aPath[$i] & " ...does not exist!", 2) EndIf Next Return _ArrayToString($aPath, @CRLF) EndFunc ;==>CheckIfSrcDataExists Edited July 27 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mr-es335 Posted July 27 Author Share Posted July 27 (edited) NIne, Thank you for the reply...appreciated! "WOW!" and "Double WOW!" I am attempting to avoid the "cycling through" of the listing. What I am looking to do is to list the contents of the search in a MsgBox with a "Yes" or a "No" in response of the search. For example: Results of search: C:\Program Files\Common Files\Native Instruments Yes C:\Program Files\Native Instruments No C:\RML\SAC\VST_PlugIns\Ampsim No C:\RML\SAC\VST_PlugIns\Ampsim.ini Yes. Something akin to the attached... Thanks again, Nine! PS: Have you ever watched "Dr. Phibes Rises Again". Vincent Prices =, as Dr Phibes, has a very interesting employment of the term "nine". Edited July 27 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Nine Posted July 27 Share Posted July 27 (edited) Just add a new column to $aPath before the loop with _ArrayColInsert ($aPath, 1). In the loop assign $aPath[$i][1] = <result of search Yes or No>. Modify _ArrayToString accordingly. ps. Nope never watched that. I mostly watch french TV. What would that employment be ? FYI, Nine comes from one of the Beatles song (well if we can call it a song )... Edited July 27 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mr-es335 Posted July 27 Author Share Posted July 27 Nine, Can you provide me with a simple example that I can build upon? In the movie, 9 doctors were involved in performing surgery on Phibes' wife. As can be expected, the surgery did not go as expected. Thus, Phibes goes on a "vengeance is mine" spree stating, "Nine times nine is nine!" "Nine killed her...nine must die!" • My apologies, the movie is actually called, "The Abominable Dr Phibes". mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Solution Nine Posted July 28 Solution Share Posted July 28 Something like this : #include <Array.au3> #include <Constants.au3> #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) ; since some files/folder are in windows folder Local $sResult = CheckIfSrcDataExists() MsgBox($MB_SYSTEMMODAL, "Results!", $sResult) Func CheckIfSrcDataExists() Local $aPath[] = ["C:\Program Files\Common Files\Native Instruments", _ "C:\Program Files\Native Instruments", _ "C:\RML\SAC\VST_PlugIns\Ampsim", _ "C:\RML\SAC\VST_PlugIns\Ampsim.ini", _ "C:\Users\Dell\AppData\Local\Native Instruments", _ "C:\Users\Dell\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Guitar Rig 5.lnk", _ "C:\Windows\System32\msvcp120.dll", _ "C:\Windows\System32\msvcr120.dll", _ "C:\Windows\SysWOW64\msvcp120.dll", _ "C:\Windows\SysWOW64\msvcr120.dll", _ "E:\Text\Native Instruments"] _ArrayColInsert($aPath, 1) For $i = 0 To UBound($aPath) - 1 $aPath[$i][1] = FileExists($aPath[$i][0]) ? "Yes" : "No" Next Return _ArrayToString($aPath, " ") EndFunc ;==>CheckIfSrcDataExists ps. I may watch that movie sometime mr-es335 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mr-es335 Posted July 28 Author Share Posted July 28 NIne, Again...."WOW!", "Double WOW!"...and even, "Tripple WOW!" I would gladly give a portion of my anatomy to be able to think the way in which some of you think! Maybe such "thinking processes" are pretty mundane for you...but not so...to me anyhow. Such "cranial deprivation" issues are never more evident than when it comes to "arrays". • I remember a cute tid-bit abut a young programmer who, upon his first time hearing about arrays, thought that this conversation was all about "financial incentives"! Anyhow, None-x-Nine=Nine! Thank you so, very, very much for your assistance and your examples. Both are very much appreciated and are indeed provocative! PS: A closing snippet for you: "A teacher takes a hand, opens a mind, and touches a heart." Nine 1 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
mr-es335 Posted July 28 Author Share Posted July 28 Good day, I hope that the day finds you well! With the assistance of Nine, I was able to rectify one of my present issues. In these "routines" I am checking both source data and destination data. • The source data has "fixed" paths • However, the destination data has variable paths based on the same of the destination folder - in the form of "Install_1a, Install_2b...and so on. Thus, I have been employing the following - all with success: ; ----------------------------------------------- #include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ------------------------------------------------ _GetSrcDir() _CheckDstData() Func _GetSrcDir() ; ------------------------------------------------ Global $sInstallationFolder = "" ; ------------------------------------------------ $sInstallationFolder = InputBox("NOTICE!", "Enter the current installation folder name...", "", "", 275, 140) ; ---------------- If @error = 1 Then Exit EndIf EndFunc ;==>_GetSrcDir ; ------------------------------------------------ Func _CheckDstData() ; ------------------------------------------------ ; Source data Local $sInstallationFolderPath = "I:\Guitar_Rig\Installations\" Local $sDataRegKeysAddMeDataFile = "\Data\Reg_Keys\add_me.reg" ; ------------------------------------------------ If FileExists($sInstallationFolderPath & $sInstallationFolder & $sDataRegKeysAddMeDataFile) Then MsgBox($MB_ICONINFORMATION, "Confirm if Folder|Data Exists", $sDataRegKeysAddMeDataFile & " ...does exist!", 3) Else MsgBox($MB_ICONINFORMATION, "Confirm if Folder|Data Exists", $sDataRegKeysAddMeDataFile & " ...does not exist!", 3) EndIf EndFunc ;==>_CheckDstData ; ------------------------------------------------ However, when attempting to incorporate Nine's ever-so-excellent suggestion - which works fine with source data, I am having issues with the destination data. For example.. the following... expandcollapse popup; ----------------------------------------------- #include <Array.au3> #include <AutoItConstants.au3> #include <Constants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ------------------------------------------------ _WinAPI_Wow64EnableWow64FsRedirection(False) ; ------------------------------------------------ _GetSrcDir() _CheckDstData() Func _GetSrcDir() ; ------------------------------------------------ Global $sInstallationFolder = "" ; ------------------------------------------------ $sInstallationFolder = InputBox("NOTICE!", "Enter the current installation folder name...", "", "", 275, 140) ; ---------------- If @error = 1 Then Exit EndIf EndFunc ;==>_GetSrcDir ; ------------------------------------------------ Func _CheckDstData() ; ------------------------------------------------ ; Source data Local $sInstallationFolderPath = "I:\Guitar_Rig\Installations\" Local $sDataRegKeysAddMeDataFile = "\Data\Reg_Keys\add_me.reg" ; ---------------- Local $sResult = _CheckDstData() MsgBox($MB_ICONINFORMATION, " Search Results!", $sResult) Local $aPath[] = [$sInstallationFolderPath & $sInstallationFolder & $sDataRegKeysAddMeDataFile] ; ---------------- _ArrayColInsert($aPath, 1) ; ----------------- For $i = 0 To UBound($aPath) - 1 $aPath[$i][1] = FileExists($aPath[$i][0]) ? "Yes" : "No" Next Return _ArrayToString($aPath, " ") EndFunc ;==>_CheckDstData ; ------------------------------------------------ ...produces the attached error... Any comments and/or suggestions? Any assistance in this matter would be greatly appreciated! mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
mr-es335 Posted July 28 Author Share Posted July 28 (edited) Good day, Well, I do believe that I have solved my current predicament! expandcollapse popup; ----------------------------------------------- #include <Array.au3> #include <AutoItConstants.au3> #include <Constants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ------------------------------------------------ _WinAPI_Wow64EnableWow64FsRedirection(False) ; ------------------------------------------------ _GetSrcDir() _CheckDstData() Func _GetSrcDir() ; ------------------------------------------------ Global $sInstallationFolder = "" ; ------------------------------------------------ $sInstallationFolder = InputBox("NOTICE!", "Enter the current installation folder name...", "", "", 275, 140) ; ---------------- If @error = 1 Then Exit EndIf EndFunc ;==>_GetSrcDir ; ------------------------------------------------ ; Source data Local $sResult = _CheckDstData() MsgBox($MB_ICONINFORMATION, " Search Results!", $sResult) ; ------------------------------------------------ _CheckDstData() ; ----------------------------------------------- Func _CheckDstData() ; ------------------------------------------------ ; Destintion data Local $aPath[] = ["I:\Guitar_Rig\Installations\" & $sInstallationFolder & "\Data\Reg_Keys\add_me.reg"] ; The updated and working text!! ; ---------------- _ArrayColInsert($aPath, 1) ; ----------------- For $i = 0 To UBound($aPath) - 1 $aPath[$i][1] = FileExists($aPath[$i][0]) ? "Yes" : "No" Next Return _ArrayToString($aPath, " ") EndFunc ;==>_CheckDstData ; ------------------------------------------------ Now for the means of being able to extend the width of the MsgBox! • Observe the attached... Edited July 28 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Nine Posted July 28 Share Posted July 28 In your example, you are running _CheckDstData() three times. No need for that, just run it once to get the results. You cannot extend the width of a message box, so the text realign itself. You will need to create your own message with a simple GUI. Or you could use this UDF : “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mr-es335 Posted July 28 Author Share Posted July 28 (edited) Nine, " You will need to create your own message with a simple GUI..." Any suggestions that I could employ in the above? Thanks! The "ExtMsgBox" appears to be way above my pea-sized intellect. Edited July 28 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Nine Posted July 28 Share Posted July 28 Use the UDF, it is much easier : #include "ExtMsgBox.au3" Local $sResult = "Very very long long test text that should be cut somewhere into the line, so need to be extended" & @CRLF & _ "Yet, another Very very long long test text that should be cut somewhere into the line, so need to be extended" & @CRLF & _ "Not so long test text that should be cut somewhere into the line, so need to be extended" & @CRLF & _ "Quite short test text that should NOT be cut somewhere into the line" _ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 800) _ExtMsgBox(64, "Ok", "Test", $sResult) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mr-es335 Posted July 30 Author Share Posted July 30 Nine, Thanks for this! I did look into this, but for rank neophytes, I do find this "option" rather difficult to understand. mr-es335 Sentinel Music Studios 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