jawed Posted June 14, 2013 Share Posted June 14, 2013 Heya Im looking for an error-code or something that runs in the Background and stops the time. it should Exit after... like 5min. i have a Batch script that runs 12 different autoit.exe's. sometimes These scripts just hang up... My Problem is that im letting them run during the night and so they shouldnt just do nothing.. better to Exit them and maybe write a file that the script xy got closed/killed. the code Looks like: start.bat: "script1.exe" ..... "script12.exe" 1 of These scripts Looks like: #include "library.au3" Programstart() ...... Programend() ive hoped for something like: #include "library.au3" countdownstart() Programstart() ...... Programend() func countdownstart() "after 5min elapsed" Exit endfunc im using a library that im including in every of These scripts... i hope i havent told it that confusing.. ^^" Link to comment Share on other sites More sharing options...
water Posted June 14, 2013 Share Posted June 14, 2013 Use TimerInit at the start of the script. Use AdlibRegister to register a function that checks the timer every n seconds and exits the script if the limit is exceeded. 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...
jawed Posted June 14, 2013 Author Share Posted June 14, 2013 I dont get that... i've tried this: Global $blubbfisch = TimerInit() AdlibRegister(errortimer(),1000 ) While 1 Sleep(500) ;~ MsgBox(0, "", "Ich bin cool", 1) WEnd Func errortimer() ;~ MsgBox(0, "", TimerDiff($blubbfisch)/1000, 1) If TimerDiff($blubbfisch)/1000 > 5 Then Exit EndFunc it wont Exit... Link to comment Share on other sites More sharing options...
FireFox Posted June 14, 2013 Share Posted June 14, 2013 (edited) Hi.;OPTION 1 AdlibRegister("_Exit", 10000) ;do stuff Func _Exit() AdlibUnregister("_Exit") Exit EndFunc ;OPTION 2 Local $hTimer = TimerInit() ;dostuff While 1 If TimerDiff($hTimer) >= 10000 Then _Exit() Sleep(10) WEnd Func _Exit() Exit EndFuncEdit: Please use autoit code tags to post your code, thanks.Br, FireFox. Edited June 14, 2013 by FireFox somebadhat and jawed 2 Link to comment Share on other sites More sharing options...
Solution jawed Posted June 14, 2013 Author Solution Share Posted June 14, 2013 thanks a lot i will use the Option 1. is there any Maximum for the time? because i want to use 5min... ^^" Link to comment Share on other sites More sharing options...
water Posted June 14, 2013 Share Posted June 14, 2013 (edited) Set 10000 (10 seconds) to 1000*60*5 (= 5 Minutes) Edited June 14, 2013 by water 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...
FireFox Posted June 14, 2013 Share Posted June 14, 2013 sure your reply is the best answer... whatever. 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