Rogge_RZN_FHDW Posted November 1, 2006 Share Posted November 1, 2006 Hello, My collegue and I have some scripts that are run frequently (possibly during all times, for example at night). Is there a possibility to terminate a script when are certain time elapsed. I thought about some kind of wrapper for the script, but maybe there is a way of doing it inside the script. Thanks for your help, Benni and Nico Link to comment Share on other sites More sharing options...
Azu Posted November 1, 2006 Share Posted November 1, 2006 Hello,My collegue and I have some scripts that are run frequently (possibly during all times, for example at night). Is there a possibility to terminate a script when are certain time elapsed. I thought about some kind of wrapper for the script, but maybe there is a way of doing it inside the script.Thanks for your help,Benni and NicoPut$a=timerinit()at the start of your code.Then, in your loop, but something likeif timerdiff($a)>1000 then exitlooptimerdiff($a) equals the amount of milliseconds since $a=timerinit() was run. Link to comment Share on other sites More sharing options...
Rogge_RZN_FHDW Posted November 1, 2006 Author Share Posted November 1, 2006 (edited) Put $a=timerinit() at the start of your code. Then, in your loop, but something like if timerdiff($a)>1000 then exitloop timerdiff($a) equals the amount of milliseconds since $a=timerinit() was run. We thougt about this. However, It might be possible that our script is waiting for a window that does not exist. There is not always a loop in our script. Right now, we have some kind of wrapper: run("script.exe") sleep($delay) $PID = ProcessExists("script.exe") If $PID Then ProcessClose($PID) EndIf Edited November 1, 2006 by Rogge_RZN_FHDW Link to comment Share on other sites More sharing options...
Azu Posted November 1, 2006 Share Posted November 1, 2006 You could try using winwait to check for the window and you can set a timeout on it so it won't hang. OR you could make the if timerdiff statement into an adlib, and have it exit the script instead of exitloop. WinWait("Untitled", "", 5) Makes the winwait timeout after 5 seconds 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