Vitaliy4us Posted June 1, 2017 Share Posted June 1, 2017 (edited) I have a parent script which includes some other scripts. They are executed one by one. If a problem occures in one of them the script should be scipped and the next one should start. How I can do this. Exit stops the parent scripts, goto is missing. Should I use loop? But it looks not good enough. Is there any other way? Edited June 1, 2017 by Vitaliy4us Link to comment Share on other sites More sharing options...
water Posted June 1, 2017 Share Posted June 1, 2017 Hard to tell without having seen your code. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 1, 2017 Moderators Share Posted June 1, 2017 @Vitaliy4us it is extremely difficult to give you suggestions with no code to go on. Typically, you would put your code into functions in a single script, or if it is repeatable code you could create a UDF and call it from your main script. How you exit the function, whether in the main script or a UDF, will determine what happens with the rest of the script. Again, tho, it's difficult to drill down to specifics without seeing how your code is laid out. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Vitaliy4us Posted June 1, 2017 Author Share Posted June 1, 2017 This is the code: ;Test suit #1 #include "commonConstantsAndFunctions.au3" Local $log = "testsuit1.log" FileWrite($log, "Test suit number 1" & @CRLF & @CRLF) #include "test1_1.au3" MsgBox(0, "Test suit 1", "Test 1_1 finished", 2) #include "test1_2.au3" MsgBox(0, "Test suit 1", "Test 1_2 finished", 2) #include "test1_3.au3" MsgBox(0, "Test suit 1", "Test 1_3 finished", 2) #include "test1_4.au3" MsgBox(0, "Test suit 1", "Test 1_4 finished", 2) MsgBox(0, "Test results", "Test suit 1 is finished", 10) Link to comment Share on other sites More sharing options...
water Posted June 1, 2017 Share Posted June 1, 2017 Can you please post one of the test1_*.au3 includes so we can see how you call the code in there? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Vitaliy4us Posted June 1, 2017 Author Share Posted June 1, 2017 (edited) 9 minutes ago, water said: Can you please post one of the test1_*.au3 includes so we can see how you call the code in there? ;Test 1_1. Send fax without attachments. #include "commonConstantsAndFunctions.au3" #include "SysTrayUDF.au3" #include <Date.au3> Local $testName = "Test 1_1. Send fax without attachments." Local $subj = $testName & " " & _now() Local $body = "This is an automation fax for testing fax sending without attachments" If ProcessExists($ClientProcessName) == 0 Then ReloadClient($clientAccounLoginGW, $clientAccounPasswordGW) ;For example if a problem occures here, the script should stop ;and the next one (test1_2.au3) should to continue EndIf OpenFromTray("New fax") Local $ParameterExpectedValue = True Local $ParameterValue = SendFax(1000,$subj, $body, "") WriteToLog($ParameterValue, $ParameterExpectedValue, $testName & " is OK", $testName & " FAILED", False) Edited June 1, 2017 by Vitaliy4us Link to comment Share on other sites More sharing options...
water Posted June 1, 2017 Share Posted June 1, 2017 As suggested " put your code into functions". ; Test suit #1 #include "commonConstantsAndFunctions.au3" #include "test1_1.au3" #include "test1_2.au3" #include "test1_3.au3" #include "test1_4.au3" Local $log = "testsuit1.log" FileWrite($log, "Test suit number 1" & @CRLF & @CRLF) test1_1() MsgBox(0, "Test suit 1", "Test 1_1 finished", 2) test1_2() MsgBox(0, "Test suit 1", "Test 1_2 finished", 2) test1_3() MsgBox(0, "Test suit 1", "Test 1_3 finished", 2) test1_4() MsgBox(0, "Test suit 1", "Test 1_4 finished", 2) MsgBox(0, "Test results", "Test suit 1 is finished", 10) test1_1.au3: ;Test 1_1. Send fax without attachments. #include "commonConstantsAndFunctions.au3" #include "SysTrayUDF.au3" #include <Date.au3> Func Test_1_1() Local $testName = "Test 1_1. Send fax without attachments." Local $subj = $testName & " " & _now() Local $body = "This is an automation fax for testing fax sending without attachments" If ProcessExists($ClientProcessName) == 0 Then ReloadClient($clientAccounLoginGW, $clientAccounPasswordGW) EndIf ; If error occurs then end this test and return to the main script If @error = 1 Then Return OpenFromTray("New fax") Local $ParameterExpectedValue = True Local $ParameterValue = SendFax(1000,$subj, $body, "") WriteToLog($ParameterValue, $ParameterExpectedValue, $testName & " is OK", $testName & " FAILED", False) EndFunc My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Vitaliy4us Posted June 1, 2017 Author Share Posted June 1, 2017 7 minutes ago, water said: As suggested " put your code into functions". Thank you, it looks much better then using loop/ExitLoop. The only problem is to refurbish 2 hundreds scripts... 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