netnet227 Posted February 19, 2009 Posted February 19, 2009 I am using ablibenable to capture the exception. I found it only works at first time. CaptureException function will never been called after called once. I paste my script as following. dose any one have some idea? ; CS Global $gTestCaseId = 1 DDT_Main() Func DDT_Main() local $iEndTestCaseId=3 for $iTestCaseId=$gTestCaseId to $iEndTestCaseId Debug("--------------------------------------------------------") Debug("Doing the " & $iTestCaseId) AdlibEnable("CaptureException",1200) ; 20 sec Debug("AdlibEnable") Sleep(300000) ; each loop supposed to go to CaptureException. but only first time works, why?? AdlibDisable() Debug("AdlibDisable"); Next EndFunc Func CaptureException() Debug("entering the CaptureException.......") AdlibDisable() Debug("AdlibDisable from the CaptureException") sleep(2000) ;startup again $gTestCaseId = $gTestCaseId + 1 DDT_Main() EndFunc Func Debug($message) Local $previous = ControlGetText( "Untitled - Notepad","", "Edit1") ControlSetText( "Untitled - Notepad","", "Edit1", $previous & $message & @CRLF) EndFunc ;CE
Developers Jos Posted February 19, 2009 Developers Posted February 19, 2009 You do a AdlibDisable() in it so would be expected. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Danny35d Posted February 19, 2009 Posted February 19, 2009 Look inside CaptureException() function your are using AdlibDisable() which disable AdlibEnable().Func CaptureException()Debug("entering the CaptureException.......")AdlibDisable()Debug("AdlibDisable from the CaptureException")sleep(2000);startup again$gTestCaseId = $gTestCaseId + 1DDT_Main()EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
netnet227 Posted February 19, 2009 Author Posted February 19, 2009 Look inside CaptureException() function your are using AdlibDisable() which disable AdlibEnable().but in the ddt_main(), i always open it again:AdlibEnable("CaptureException",1200) ; 20 secso it will always work like: enable->disable->enable>disable.......why i want to disable and enable it is because i want to reset the timer to 0. Is there something wrong?
Moderators Melba23 Posted February 19, 2009 Moderators Posted February 19, 2009 netnet227,You have a serious problem in your function nesting.You call DDT_Main(). During this function you AdlibEnable CaptureException(). This function call the main DDT_Main() function again while the original call to the function is stuck in the Sleep(300000) pause. You are stacking up DDT_Main() calls every 1.2 seconds during a 300 second pause. If you reduce the Adlib time and the pause to more reasonable sizes you can see what is happening.I suggest you start again because I am not sure what you have is salvagable - at least I am not trying!What is it that you want to do? Perhaps we could start again.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Developers Jos Posted February 19, 2009 Developers Posted February 19, 2009 No you never finish the called function because you have DDT_Main() in the called func. You need to use Return to exit it. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
netnet227 Posted February 19, 2009 Author Posted February 19, 2009 netnet227,You have a serious problem in your function nesting.You call DDT_Main(). During this function you AdlibEnable CaptureException(). This function call the main DDT_Main() function again while the original call to the function is stuck in the Sleep(300000) pause. You are stacking up DDT_Main() calls every 1.2 seconds during a 300 second pause. If you reduce the Adlib time and the pause to more reasonable sizes you can see what is happening.I suggest you start again because I am not sure what you have is salvagable - at least I am not trying!What is it that you want to do? Perhaps we could start again.M23what i want to achive is:I have test case 1 to 10. i will do it one by one, if one fails the UI will freeze. i need detect it and terminate it and start to do the next one.what do you mean by "start again"? If the current ddt_main could return, that will solve the problem. but how can i return/exit it?
Moderators Melba23 Posted February 19, 2009 Moderators Posted February 19, 2009 netnet227,When I say "start again" I mean just that - rethink your logic and start coding a new script. As it stands, your current script is hopelessly recursive and, in my opinion, stands little chance of ever running successfully. Merely scripting a "Return" from DDT_Main is unlikely to be the solution.Why do you say the UI freeze will if the test fails? Can you not create some errorchecking code to prevent that? What are you testing that is so unforgiving?You need to get the test as a self-contained function so you can loop through the 10 of them in a more conventional manner. Please explain in more detail what it is you are doing in your testing function and I am sure we can get something that runs smoothly.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
netnet227 Posted February 19, 2009 Author Posted February 19, 2009 netnet227,When I say "start again" I mean just that - rethink your logic and start coding a new script. As it stands, your current script is hopelessly recursive and, in my opinion, stands little chance of ever running successfully. Merely scripting a "Return" from DDT_Main is unlikely to be the solution.Why do you say the UI freeze will if the test fails? Can you not create some errorchecking code to prevent that? What are you testing that is so unforgiving?You need to get the test as a self-contained function so you can loop through the 10 of them in a more conventional manner. Please explain in more detail what it is you are doing in your testing function and I am sure we can get something that runs smoothly.M23M23,the target is a huge and legacy system. everything will happen when running the test target. for example "memory access violation" or some business logic I failed to(and impossible to) predict. 10 is just a number i gave an example, actually, it's few hundreds at least. also, i realized the problem with the nested function. There's ugly way to do it by writing the current test case number to a file. when exception happens, Exit the whole autoit3.exe and restart from the next number.but i still wondering if there's good way to handle this.
Moderators Melba23 Posted February 19, 2009 Moderators Posted February 19, 2009 netnet227, So make each test run a separate process. Then if it freezes you should be able to detect that it is dead, kill it, and start the next one in the line. (I am assuming, given that you were originally looping through them, that each of the tests is identical apart from a few parameters that are dependent on the series number of the test.) How to proceed? Write the test as a separate script and then use FileInstall or Zedna's Resources UDF to get it into the compiled .exe. Then write it to a temp directory and run it with suitable parameters. Your main script runs throughout and keeps tabs on the serial number of the test so it knows which one to run next. Or have I greatly underestimated the problem? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
netnet227 Posted February 19, 2009 Author Posted February 19, 2009 netnet227,So make each test run a separate process. Then if it freezes you should be able to detect that it is dead, kill it, and start the next one in the line. (I am assuming, given that you were originally looping through them, that each of the tests is identical apart from a few parameters that are dependent on the series number of the test.)How to proceed? Write the test as a separate script and then use FileInstall or Zedna's Resources UDF to get it into the compiled .exe. Then write it to a temp directory and run it with suitable parameters. Your main script runs throughout and keeps tabs on the serial number of the test so it knows which one to run next.Or have I greatly underestimated the problem?M23M23,Thank for your help. It's a good idea to go around the nested function issue. I will try it later.
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