Help with keystrokes and timer please!!!

Get help with using AutoHotkey and its commands and hotkeys
Damsz
Posts: 3
Joined: 23 Feb 2018, 18:47

Help with keystrokes and timer please!!!

23 Feb 2018, 18:59

I started making a script but, When it get to 2 mins on the second button that needs to be pressed, the first time its exactly 2 mins, then every time after that it changes to 4 min intervals.

__________________________________________________________________________________
F12::Pause, Toggle ;Button to Pause\Start program
F11:: ;Button to ONLY start script


SetTimer, 3000msKeyset, 3000 ; Set timer to run every 3000 milliseconds
SetTimer, 2mKeyset, 120000 ; 120000 ms = 2 minutes, so this timer label will be run every 2 minutes
SetTimer, 15mKeyset, 900000 ; 900000 ms = 15 minutes, so this timer label will be run every 15 minutes

3000msKeyset: ; 3000 ms keyset after this label
Send {LButton} ;left button mouse click
return

2mKeyset: ; 2 minute keyset after this label
Send {5}
return

15mKeyset: ; 15 minute keyset after this label
Send {4}

return
__________________________________________________________________________________



If there is a better way to make this work or any help would be much appreciated,
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Help with keystrokes and timer please!!!

24 Feb 2018, 01:17

The only thing you forgot was the return after settimers. Let me try the script, give me a minute.

Update: It's working for me try the script after putting a 'return' after the three settimers. Nothing else is wrong. Try left clicking the script, twice, in the tray when it's running, it
should give you a log.
I am your average ahk newbie. Just.. a tat more cute. ;)
Damsz
Posts: 3
Joined: 23 Feb 2018, 18:47

Re: Help with keystrokes and timer please!!!

26 Feb 2018, 05:03

Still the same issue, when the script runs the timing is way different to what I have in the script.
User avatar
evilC
Posts: 4359
Joined: 27 Feb 2014, 12:30

Re: Help with keystrokes and timer please!!!

02 Mar 2018, 07:51

Seems fine to me.
I shortened the times so that I did not have to wait so long, but it appears to fire at the correct time intervals.

Code: Select all

F12::Pause, Toggle ;Button to Pause\Start program
F11:: ;Button to ONLY start script

t := A_TickCount
SetTimer, 3000msKeyset, 3000 ; Set timer to run every 3000 milliseconds
SetTimer, 2mKeyset, 12000 ; 120000 ms = 2 minutes, so this timer label will be run every 2 minutes
SetTimer, 15mKeyset, 90000 ; 900000 ms = 15 minutes, so this timer label will be run every 15 minutes
return

3000msKeyset: ; 3000 ms keyset after this label
ToolTip % "3000msKeyset fired after " (A_TickCount - t) / 1000 " seconds"
;~ Send {LButton} ;left button mouse click
return

2mKeyset: ; 2 minute keyset after this label
ToolTip % "2mKeyset fired after " (A_TickCount - t) / 1000 " seconds"
;~ Send {5}
return

15mKeyset: ; 15 minute keyset after this label
ToolTip % "15mKeyset fired after " (A_TickCount - t) / 1000 " seconds"
;~ Send {4}

return

Return to “Ask For Help”

Who is online

Users browsing this forum: 8bitgunny, Bing [Bot], blad4, Ggirf14, Google [Bot], Hampoon, hidefguy, L3628QH, labrint, rogerrabbitthefirst, swagfag and 56 guests