Jump to content

Rerun the script depending on certain conditions


Recommended Posts

Hi,

I would like to know how do I make a script to restart after every 'x' minutes depending on the condition that the script is idle for certain amount of time?

My scenario is I read from a csv file and pass the read line as the argument to a certain function. This function takes almost 30 minutes to complete. Now, if the script fails within these 30 minutes, I would like the script to go the next line of csv and call the function again.

I hope this is clear.

Link to comment
Share on other sites

Hi,

I would like to know how do I make a script to restart after every 'x' minutes depending on the condition that the script is idle for certain amount of time?

My scenario is I read from a csv file and pass the read line as the argument to a certain function. This function takes almost 30 minutes to complete. Now, if the script fails within these 30 minutes, I would like the script to go the next line of csv and call the function again.

I hope this is clear.

Welcome TempAuto.

I would say that you should rethink the approach. If you called a function and then called it again if it didn't return from that function within a certain time then you would be executing that function twice, the first execution would hang while the second proceeded. You could do that with a AdLibRegister command. But another interrupt by AdLibRegister will be queued until the first one completed so you will never be able to start a third call to the function if the second one took too long. Even if you could call a third time you will run into all sorts of problems.

I would recommend writing the function in such a way that it checked how long since it was called every now and then, using TimerDiff maybe, and returned some error code if the maximum time had passed. The function, or any script come to that, should be wriiten so that if some part fails then it can deal with the failure in some sensible way.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...