Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Delay/Wait Between Actions
#1
Thank you for providing support through your forum.

I would like to insert a random (interval between 10 seconds and 10 minutes) wait between steps/actions in the macro. Could someone show me how?
#2
Macro Macro2126
Code:
Copy      Help
int i
for i 0 10
,wait RandomInt(1 10) ;;wait 1-10 s
,out i
#3
Hi Gintaras, thank you for the reply.

I'm not quite sure I understand how to reformat that if I were to use different random intervals.
For example, if I were to change the values so that it fits between 38 seconds and 4 minutes, do I have to modify "for i 0 10" on line 2 as well?
Assuming that your code is for intervals between 10 seconds and 10 minutes (your comment "wait 1-10 s" is confusing me, because when I see "s", I supposed it means "seconds".

Is there also a way to output the random delay into a text file, just so I can make sure that the intervals fit within the range?
#4
Create function like this, change the values.
Function WaitRandom_02s_to_3s
Code:
Copy      Help
;/
double wt=0.2+(RandomNumber*(3-0.2))
out wt
wait wt
Replace out to LogFile if need.

Run this macro to test it.
Macro Macro2133
Code:
Copy      Help
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
WaitRandom_02s_to_3s
out "step"
#5
Awesome, making a function and linking it actually makes the whole macro a lot cleaner! Thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)