mr-es335 Posted September 18 Share Posted September 18 Good day, Most of my scripts consist of two parts... Part 1: The "action" part • This part generally performs a copy, move or delete operation Part 2: The "check" part • This part generally verifies if the above has been successfully completed. Following is an example of a "Part 1" part: ; ----------------------------------------------- #include <FileConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _UpdatePIFolder() ; ----------------------------------------------- Func _UpdatePIFolder() ; ----------------------------------------------- ; Source data Local $_sSrcPath1 = "C:\Program Files\Native Instruments\VSTPlugins 64 bit\Guitar Rig 5.dll" Local $_sSrcPath2 = "D:\Install\App_Install\Digital_Audio\2_GR5\Assets\Ampsim.ini" ; ---------------- ; Destination data Local $_sDstPath1 = "C:\RML\SAC\VST_PlugIns\Ampsim" Local $_sDstPath2 = "C:\RML\SAC\VST_PlugIns" ; ----------------------------------------------- SplashTextOn("NOTICE!!", "Update PI data...", 350, 50, -1, -1) Sleep(1000) ; ----------------------------------------------- FileMove($_sSrcPath5, $_sDstPath5, $FC_OVERWRITE + $FC_CREATEPATH) FileCopy($_sSrcPath6, $_sDstPath6, $FC_OVERWRITE) ; ----------------------------------------------- SplashTextOn("NOTICE!!", "Update PI data completed...", 350, 50, -1, -1) Sleep(1000) SplashOff() EndFunc ;==>_UpdatePIFolder ; ----------------------------------------------- ...and, following is an example of a "Part 2" part: ; ----------------------------------------------- #include <Array.au3> #include "ExtMsgBox.au3" ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _GetDSTResult() _CheckDstData() ; ----------------------------------------------- Func _GetDSTResult() ; Source data Local $sResult = _CheckDstData() _ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 1000) _ExtMsgBox(64, "Ok", " Search Results!", $sResult) EndFunc ;==>_GetDSTResult ; ----------------------------------------------- Func _CheckDstData() ; Destination data Local $aPath[] = ["C:\RML\SAC\VST_PlugIns\Ampsim\Guitar Rig 5.dll", _ "C:\RML\SAC\VST_PlugIns\Ampsim\Ampsim.ini"] ; ----------------- _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 ; ----------------------------------------------- Based on the above two examples, my two questions then are... Question 1: Can [If...Then] keywords be employed to eliminate Part 2? Question 2: If true, can, or, how can the [If...Then] keywords be employed to "read" multiple entries and/or data - as in the second example above? Any assistance in this matter would be greatly appreciated! mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
water Posted September 18 Share Posted September 18 Why not combine everything into a single statement? If FileMove($_sSrcPath5, $_sDstPath5, $FC_OVERWRITE + $FC_CREATEPATH) = 1 Then ; ... Everything worked Else ; ... Add your error handling here EndIf My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mr-es335 Posted September 18 Author Share Posted September 18 water, Thanks for the assistance here...however, as I am "slow of brain", my I get responses to my tow question first? • I must first learn to walk before I can learn to run...is my motto in such matters. mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
water Posted September 18 Share Posted September 18 I do not think it is a question of walking or running. It is a question of choosing the shortest and easiest track. You add so much complexity to solve a rather easy task. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mr-es335 Posted September 18 Author Share Posted September 18 (edited) water, You stated, "You add so much complexity to solve a rather easy task. " In "pedagogical circles", I am what you would refer to as "Type 2 learner"....simply inferring that ..."I tend to start big,...and then, when comprehension sets in...I will then tend to go smaller." water...just because "you see it"...should never infer that I - or anyone else, for that matter..."should see it"...in the exact same...or more specifically, identical, manner! Edited September 19 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
water Posted September 19 Share Posted September 19 I'm not telling you how you should see the world. My posts only reflect my point of view. I have written a lot of scripts. Hence I know where you end when you start with too much complexity. Adding new functions to the script or debugging your code becomes a real nightmare. But it is as simple as this: take it or leave it My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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