How can I run a function every 30 minutes?

Support
  • Anyone knows how can I run a function in BAS every 30 minutes?

    Appreciate it

  • @andrewem24 said in How can I run a function every 30 minutes?:

    Anyone knows how can I run a function in BAS every 30 minutes?

    Appreciate it

    • Sleep for 30 minutes.
    • Run the function
    • Wait for the function to finish.
    • Repeat.
  • @sergerdn I'm looking for my program to work with no sleeping.

    Right now It's running my function every 60 minutes using DATE Bas module. I just get current minute from DATE. So every hour at minute 6 it will run my function.

    My problem is that 60 minutes it's too long and that's why i'm looking to run this function every 30 minutes give or take

    For example at:
    11:06 - it's running my function
    12:06 - it's running my function
    13:06 - it's running my function
    14:06 - and so on

  • while ( true ) {
       while( Date.now() < [[MF_TIME]] ) Sleep (1000);
       [[MF_TIME]] = Date.now() + 30 * 60 * 1000;
       MyFunction;
    }
    
    
  • If you have multiple browser threads then you can add a date column in database for each account. When some action is finished then you can add 30 minutes to the date now and add it to the database of that particular account. Then add a check condition in the beginning of the thread which checks if the current date is less or greater than the database date. If it is greater that means there is still time left and then close that thread without opening browser.

  • 0 Votes
    2 Posts
    327 Views
  • Function execution rate

    Support
    0 Votes
    3 Posts
    509 Views
  • Running few threads at a time

    Support
    0 Votes
    3 Posts
    762 Views
  • Limit the running threads

    Support
    0 Votes
    4 Posts
    961 Views
  • Can't Loop Through List Of URLS

    Support
    0 Votes
    2 Posts
    1176 Views