Audio and cycle with random max number

I’m newbie. I’d like to know if there is a command like “wait for the audio to end”.
Furthermore, I’d like a cycle that for a random number of times, clicks on a specific button, for another random times clicks on another specific button, and so on. I hope I was clear.
Thank you to anyone who will help me.

To clarify: So you use UI.Vision to play a sound file, and then want it to wait until the replay has ended?

UIV can not listen to sound, but it can see! => So I think you can make it wait, for example, until the Play button (of the audio replay tool) becomes enabled again. I am sure something changes visually once the replay is done, and UV can use this as a trigger.

Here is how to wait for an image: If {picture} than {do this} endif

Thank you! And what about the cicle I asked for?

For a cycle, you can use the WHILE…END command