Need Autoscroll with a twist

Ask gaming related questions (AHK v1.1 and older)
Coder192
Posts: 3
Joined: 26 Jun 2022, 23:43

Need Autoscroll with a twist

Post by Coder192 » 26 Jun 2022, 23:51

Im trying to scroll up very far in messenger chats, but for some reason every couple of times it loads more old messages I need to scroll down once for it to continue scrolling. I tried doing it by hand and I still had to scroll down and back up again.

I need an auto scroller that scrolls up for around 10 seconds then scrolls down for 1 second and repeats. Can someone please help me with this? I would be very appreciative.

User avatar
mikeyww
Posts: 26888
Joined: 09 Sep 2014, 18:38

Re: Need Autoscroll with a twist

Post by mikeyww » 27 Jun 2022, 05:37

Welcome to this AutoHotkey forum!

Code: Select all

delay = 40
Loop, 2
 For each, keySec in ["PgUp|10", "PgDn|1"] {
  part := StrSplit(keySec, "|"), end := A_TickCount + 1000 * part.2
  While (A_TickCount < end) {
   Send % "{" part.1 "}"
   Sleep, delay
  }
 }
MsgBox, Done!

Coder192
Posts: 3
Joined: 26 Jun 2022, 23:43

Re: Need Autoscroll with a twist

Post by Coder192 » 27 Jun 2022, 10:01

Hi Mikey. Thank you for your code. I am a complete newbie to coding and don't know what button to press to activate this code or what I need to add to it. When I try to load it up it says error missing '}'. Sorry for the inconvenience can you please assist me.

User avatar
mikeyww
Posts: 26888
Joined: 09 Sep 2014, 18:38

Re: Need Autoscroll with a twist

Post by mikeyww » 27 Jun 2022, 10:11

Copy & paste exactly from this page. Test by itself, with no other code, while Notepad is the active window. My AHK version: 1.1.34.03.

Code: Select all

delay = 40                                                          ; Milliseconds delay after each send
F3::                                                                ; F3 = Start this hotkey routine
Loop, 2                                                             ; Number of times to loop
 For each, keySec in ["PgUp|10", "PgDn|1"] {                        ; Loop through the array elements
  part := StrSplit(keySec, "|"), end := A_TickCount + 1000 * part.2 ; Find the ending time
  While (A_TickCount < end) {                                       ; While ending time is not yet reached,
   Send % "{" part.1 "}"                                            ;  send the key,
   Sleep, delay                                                     ;  and wait a short while
  }
 }
MsgBox, Done!
Return

Coder192
Posts: 3
Joined: 26 Jun 2022, 23:43

Re: Need Autoscroll with a twist

Post by Coder192 » 27 Jun 2022, 11:31

It worked. Thank you so much!

Post Reply

Return to “Gaming Help (v1)”