SK_DELAY random?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
garycee
Newbie
Posts: 17
Joined: Mon Jul 20, 2015 7:17 pm

SK_DELAY random?

Post by garycee » Sun Jul 26, 2015 6:30 pm

Hi

I hope you are all as well as can be.

Is there a way to make SK_DELAY insert characters with a random delay between 500ms and 4,000ms?

Thanks for any help in advance.

~Gary. =)

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: SK_DELAY random?

Post by hagchr » Sun Jul 26, 2015 8:56 pm

Hi, My understanding is that you could arrange SK_DELAY to be random, however, if you use Send> then one SK_DELAY would apply to the whole text in the Send command (so the delay would be the same for each character). If you want separate delays for separate characters then I think you could to do something like:

Code: Select all

Run>Notepad
WaitWindowOpen>Notepad*

Let>String=Hello!
Length>String,StringLength

Let>ct=0
While>ct<StringLength
    Add>ct,1

    //Generate random delay    
    Random>3501,tmp
    Let>TimeDelay={%tmp%+500}
    Timer>intElapsed
    Let>TargetTime={%intElapsed%+%TimeDelay%}

    Let>time=0
    While>time<TargetTime
        Timer>time
    EndWhile
    
    MidStr>String,ct,1,tmp
    SendText>tmp
EndWhile

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts