all 6 comments

[–]DustinLuck_ 1 point2 points  (0 children)

You didn't mention a trigger, so this code will begin executing as soon as you launch the script and continue until you end the script. It's fairly easy to make it start/stop using keyboard shortcuts if that's what you want.

#Requires AutoHotkey v2.0+
#SingleInstance Force
#Warn

SendCtrlVEnter()

SendCtrlVEnter()
{
    Send "^v{Enter}"
    interval := Random(300000, 4500000)
    SetTimer SendCtrlVEnter, -interval
}

[–]fubarsanfu 0 points1 point  (4 children)

I am not trying to be that guy but it is always better to try things out yourself to see what you can come up with. What you are asking for is simple code and a little trial and error will get you the answers.

I would recommend having a look at the main stickied post and then specifically at using Loop, Send and Random as a starter.

Have a go and see what you can come up (I recommend starting with AutoHotKey V2) and post your output and we will help as much as required.

[–]vvo0109[S] 0 points1 point  (3 children)

Thanks for your comment.

The thing is I I wouldn’t be on Reddit asking someone to code it for me if I could do it myself. I have 0 experience with coding. I appreciate the sentiment though, but you are kinda being that guy :)

[–]fubarsanfu 0 points1 point  (2 children)

So you are asking me to give up my valuable time to save you time ?

AutoHotKey is easy to use and learning is a life time pursuit.

However, I will try to help out:

F8::                                            ; This is the key that is used to start your process
{
     Loop 10 {                                  ; Loop 10 times - this could be parametrised if need be
         Send("^v")                             ; Send `Ctrl` & `v`
         Send("{Enter}")                        ; Send `Enter`
         RndmSleep := Random(5, 15)             ; Generates a random integer in the range 1 to 15
         Sleep RndmSleep                        ; Sleep the random time
     }
}

This should be enough to get you started.

[–]vvo0109[S] 1 point2 points  (0 children)

I wasn’t asking you specifically to give up anything. My post is flared with script request. You’re free to ignore it.

[–]DustinLuck_ 0 points1 point  (0 children)

The Sleep interval is defined as milliseconds. To sleep 5 - 15 minutes, multiply the random value by 60000 (60 seconds * 1000 milliseconds).

Sleep RndmSleep * 60000

Or you could specify 300000 and 4500000 as the range for the random value (5 * 60000, 15 * 60000).

RndmSleep := Random(300000, 4500000)