My simple script is not working - newb need some help. :-)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Buteleczka
Posts: 1
Joined: 18 May 2021, 08:21

My simple script is not working - newb need some help. :-)

18 May 2021, 08:25

Hey guys,

What I'm trying to achieve is to trigger ctrl+up, ctrl+down key combo (delay random few miliseconds between them), and then wait random period between 10 to 13 minutes between next combo trigger.

I came up with something like this:

Code: Select all

#SingleInstance force
SetTimer, ClickTimer, 2000
return

ClickTimer:
; If User has been idle for 10 mins
if (A_TimeIdle >= 600000)
    send {control down}{up}{down}{control up}
return
Unfortunately, I don't know on how to do random, and the script is not working anyway... I am an old guy and this is the best I could do. Will you be kind enough to help me?

Thank you!
User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: My simple script is not working - newb need some help. :-)

18 May 2021, 09:39

I'm not sure where you want to apply the random value, but one example is below.

Code: Select all

#Persistent
Start:
Random, rand, 500, 2500
SetTimer, ClickTimer, -%rand%
Return
ClickTimer:
SoundBeep, 1500
If (A_TimeIdle > rand) {
 Send {Ctrl down}{Up}{Down}{Ctrl up}
 SoundBeep, 1000
}
Gosub, Start
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], ntepa and 240 guests