If activity run time

Hi Team,

i need to run the BOT between 10 AM and 10 PM in if activity what should i write?
also another one to run it in each 30 min (10:30 11:00 11:30 …etc)

@omar_ismail

Ideally it would be good idea to create a trigger for this interval rather than doing it in the process

Cheers

@omar_ismail

DateTime.Now.TimeOfDay >= New TimeSpan(10, 0, 0) AndAlso DateTime.Now.TimeOfDay <= New TimeSpan(22, 0, 0)

DateTime.Now.Minute Mod 30 = 0 AndAlso DateTime.Now.TimeOfDay >= New TimeSpan(10, 30, 0)

like this?


that’s mean the BOT will run between 10AM to 10PM every 30 min?

@omar_ismail This means Bot can enter in Then block only between this time

If you want it to run from 10am to 10pm every 30 minutes you create a Time Trigger in Orchestrator and use the advanced condition with a CRON expression.

Hi @omar_ismail

DateTime.Now.TimeOfDay >= New TimeSpan(10, 0, 0) AndAlso DateTime.Now.TimeOfDay <= New TimeSpan(22, 0, 0)

If you want to trigger the program in the Orchestrator with CRON expression.
Check the below CRON Expression.

0 30/30 10-22 ? * * *

It will from 10am to 10pm for every half an hour in all days.

Hope it helps!!

sorry but i am not sure i got you,
you mean the BOT will run between the 10 am and 10 pm each 30 min?

@omar_ismail
How are you running the process? Is it Orchestrator base?

no it’s not
and if u can provied me with a video to learn how to run it on the Orchestrator base i will be thankfull.

Hi @omar_ismail

May be this link will help you in understanding how to publish an process, and run it from Orchestrator base.

Hope it helps!!
Regards,

1 Like

thanks a lot
however i need to make sure of the above expressions as i need to run the BOT now so any advice?

Hi @omar_ismail

For the first one use this below condition:

Now.TimeOfDay >= New TimeSpan(10, 0, 0) AndAlso Now.TimeOfDay <= New TimeSpan(22, 0, 0)

for second one you can use below syntax in If condition

DateTime.Now.Hour >= 10 AndAlso DateTime.Now.Hour <= 22 AndAlso DateTime.Now.Minute Mod 30 = 0

use this cron expression:

0,30 10-22 * * *

It will run for every half an hour from 10 am to 10 pm

Hope it helps!!
Regards,

@omar_ismail

0 30/30 10-22 ? * * *

This is the Cron Expression, It will start from 10AM and will run after every 30 mints till 10PM

image

so i can use this 0,30 10-22 * * * instead of the above?

@omar_ismail No Bro. Are you not getting my point.
This is Cron Expression and it can be use in Orchestrator only to set Trigger.
If you want to implement the Code by putting Condition then you need to
Restrict your code by putting Conditions Which I gave above.

@omar_ismail
How to put Code Condition:
Put If Activity in Main Code, Place Condition and You will put all your Code in IF Condition->Then block.

It will go in then block only when condition will meet.
Otherwise it will go in Else block

yes i get your point that when i use the Orchestrator i can use this corn.

however for now i need to make sure if the above screenshot is correct and the BOT will run each 30 min between 10AM till 10PM

@omar_ismail
Cron is used when you run your process from orchestrator.