Can I use UiPath to automate an event that would fire at a certain time down to milliseconds?

Can I use UiPath to automate an event that would fire at a certain time down to milliseconds?

Thank you in advance for any help,
yeto

Hi @yeto,
Welcome to the Community!
Could you please describe a little. I’m trying to understand your thought. Maybe describe potential situation (use case) of this.

@yeto
This is going to partially depend on your system - unless you’re running a top of the line computer the answer will probably be no. On my system with nothing but the bot running I can only get hundredths of a second reliability.

This is due to a few things. For one, each activity takes some time to run. It might only be a couple milliseconds but the bot can’t do anything else in that time. So if I check for 1.000 at .998 seconds and it takes .003 to do the check then we skip right by 1.000 and go straight to 1.001.

There are programming languages that are created to run fast, so if you really need millisecond precision I would look into those or perhaps an external service that takes care of timing. Very generally speaking if a language/tool is easy to use (like UiPath) then there are some sacrifices in speed.

As @pablito said, if you could clarify what your use case is then maybe we can come up with some other suggestions for you.

Thank you for taking time to reply. I have provided more details down below.

Thank you,
yeto

Hundredths of a second reliability will be good enough. I guess one way to describe what I am trying to do is to think of an alarm clock that I want to sound at 5:31 plus 1.5 seconds. So hour = 5; minute = 31; second = 1; and milliseconds = 500 or something to that effect. When computer clock hits that time alarm sounds. Again, if it is off by x number of milliseconds will be okay. Anything that is more accurate than a full second will help.

Thank you for taking time to help,
yeto

@yeto
To get precise time you can use f for fractions of a second:
Use DateTime.Now.ToString("hh:mm:ss.ff") which will give the time as a string in the format 05:31:1.50.

Then you can just have the bot loop until DateTime.Now.ToString("hh:mm:ss.ff") = "05:31:1.50" Once this is true you can do whatever action you want to do.

That is awesome. Thank you for taking time to help.

Kind regards,
yeto

1 Like

This is going to be harder than I thought. I have some limited experience with Python, AutoIt and AutoHotKey. At this time I don’t know where to start with UiPath. Looks like I have some studying to do.

@yeto
If you have experience with Python and AutoHotKey then UiPath should come naturally. Try doing some of the basic training on academy.uipath.com and maybe do a c# tutorial if you can find one online. I’ve found UiPath to be extremely intuitive if you have a little bit of programming knowledge.

Thank you for taking time to help. I will definitely check out the academy courses.

Kind regards,
yeto

1 Like

To get precise time you can use f for fractions of a second:
Use DateTime.Now.ToString("hh:mm:ss.ff") which will give the time as a string in the format 05:31:1.50 .

Then you can just have the bot loop until DateTime.Now.ToString("hh:mm:ss.ff") = "05:31:1.50" Once this is true you can do whatever action you want to do.

Could you share a little more information to get me started as to how I would do this?

Thank you,
yeto

`

To get precise time you can use f for fractions of a second:
Use DateTime.Now.ToString("hh:mm:ss.ff") which will give the time as a string in the format 05:31:1.50 .

Then you can just have the bot loop until DateTime.Now.ToString("hh:mm:ss.ff") = "05:31:1.50" Once this is true you can do whatever action you want to do.

When I search for DateTime.New.ToString it is not found???

It should be DateTime.Now.ToString…

I am searching under “Browse and Select a .Net Type” and I am just not seeing it. Could you share as to what I am doing wrong?

Thank you,
yeto

@yeto
System.DateTime is the .Net type, the Now method belongs to that type.

That helps. Thank you.

Also, how would I set up a mouse click at cursor’s current position?

Thank you,
yeto

I think if you do a Click and don’t give it a selector or image or anything it will click wherever the cursor currently is.

I will try. Getting closer.

Thank you,
yeto

1 Like

I think I am very close but I don’t see where I can enter time to execute???

You’ll have to loop the bot until the time matches your trigger time, and then put your click activity following that. The bot will hand up waiting for the time trigger and then it will do the click.