Why AHK?

AutoHotkey (AHK) is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.

Before you are able to run any of the scripts listed below you’ll need to download AHK from the official AHK website.

 

I personally use AHK to automate all of the actions I have to perform to get in-game whenever I am playing on more than 1 account. Because I stream on 50+ accounts every day on Twitch it has definitely been worth for me to invest time in automating every step.
All of the scripts I’ve made to automate actions on RuneLite are available on this web page, included is an explanation on how to use/customize them.
If you’re stuck on any steps feel free to reach out to me, contact details are found at the bottom of this web page or on my about page.

 

CAUTION

Make sure you don’t run any of the scripts when you are logged in, because it is not allowed to automate anything when in-game. Only use these scripts to interact with RuneLite clients that are logged out of RuneLite.

Setting up RuneLite for the AHK scripts below

After the initial installation of RuneLite it’s important to have a RuneLite.exe for every RuneLite account you want to play on.

RuneLite.exe is found under: C:\Users\%USERPROFILE%\AppData\Local\RuneLite

Because I play on around 107 accounts I made a RuneLite.exe for every account I play on (copy original RuneLite.exe and just paste, then rename). My RuneLite folder looks like this:

How to copy the script below into a new .ahk file

To use the scripts below after installing AHK, paste the contents of each code in a new .ahk file by right clicking your desktop>New>AutoHotKey Script.

After pasting the code in your newly made .ahk file, save the file then double click it to run it in the background. Now your script is running, and whenever you press the hotkey you’ve assigned to the script the script will run. To learn how to assign a custom hotkey please refer to the Customizing the hotkeys in the script chapter below.

Scripts

Close down RuneLite clients

The assigned hotkey is Windows + Alt + F12, to change the hotkey please refer to the “customizing the hotkeys in the script” chapter below.

After pressing Windows + Alt + F12 windows will find all running RuneLite clients and close them without giving you a warning prompt. Don’t run this code when you’re logged in and doing dangerous stuff.

Close down RuneLite clients

#!F12::
WinGet, id, list, ahk_class SunAwtFrame
Loop, %id%
{
this_id := id%A_Index%
WinGet, active_pid, PID, ahk_id %this_id%
WinGetTitle, Title, ahk_id %this_id%
Process, Close, %active_pid%
}
return

World hopper F2P worlds, total level & PVP worlds excluded

Hop each account to unique F2P worlds without total level requirements.

World Hopper

^#F10::
WinGet, id, list, RuneLite

W301X=119
W301Y=72
W302X=119
W302Y=90
W303X=119
W303Y=108
W304X=119
W304Y=131
W305X=119
W305Y=152
W306X=119
W306Y=170
W307X=119
W307Y=191
W308X=119
W308Y=205
W309X=119
W309Y=227
W310X=119
W310Y=244
W311X=119
W311Y=264
W312X=119
W312Y=283
W313X=119
W313Y=299
W314X=119
W314Y=319
W315X=119
W315Y=342
W316X=119
W316Y=358
W317X=119
W317Y=379
W318X=119
W318Y=398
W319X=119
W319Y=415
W320X=119
W320Y=435
W321X=119
W321Y=451
W322X=119
W322Y=474
W323X=119
W323Y=490
W324X=119
W324Y=516
W325X=199
W325Y=72
W326X=199
W326Y=90
W327X=199
W327Y=108
W328X=199
W328Y=131
W329X=199
W329Y=152
W330X=199
W330Y=170
W331X=199
W331Y=191
W332X=199
W332Y=205
W333X=199
W333Y=227
W334X=199
W334Y=244
W335X=199
W335Y=264
W336X=199
W336Y=283
W337X=199
W337Y=299
W338X=199
W338Y=319
W339X=199
W339Y=342
W340X=199
W340Y=358
W341X=199
W341Y=379
W342X=199
W342Y=398
W343X=199
W343Y=415
W344X=199
W344Y=435
W345X=199
W345Y=451
W346X=199
W346Y=474
W347X=199
W347Y=490
W348X=199
W348Y=516
W349X=295
W349Y=72
W350X=295
W350Y=90
W351X=295
W351Y=108
W352X=295
W352Y=131
W353X=295
W353Y=152
W354X=295
W354Y=170
W355X=295
W355Y=191
W356X=295
W356Y=205
W357X=295
W357Y=227
W358X=295
W358Y=244
W359X=295
W359Y=264
W360X=295
W360Y=283
W361X=295
W361Y=299
W362X=295
W362Y=319
W363X=295
W363Y=342
W364X=295
W364Y=358
W365X=295
W365Y=379
W366X=295
W366Y=398
W367X=295
W367Y=415
W368X=295
W368Y=435
W369X=295
W369Y=451
W370X=295
W370Y=474
W371X=295
W371Y=490
W372X=295
W372Y=516
W373X=386
W373Y=72
W374X=386
W374Y=90
W375X=386
W375Y=108
W376X=386
W376Y=131
W377X=386
W377Y=152
W378X=386
W378Y=170
W379X=386
W379Y=191
W380X=386
W380Y=205
W381X=386
W381Y=227
W382X=386
W382Y=244
W383X=386
W383Y=264
W384X=386
W384Y=283
W385X=386
W385Y=299
W386X=386
W386Y=319
W387X=386
W387Y=342
W388X=386
W388Y=358
W389X=386
W389Y=379
W390X=386
W390Y=398
W391X=386
W391Y=415
W392X=386
W392Y=435
W393X=386
W393Y=451
W394X=386
W394Y=474
W395X=386
W395Y=490
W396X=386
W396Y=516
W397X=485
W397Y=72
W398X=485
W398Y=90
W399X=485
W399Y=108
W413X=485
W413Y=131
W414X=485
W414Y=152
W415X=485
W415Y=170
W416X=485
W416Y=191
W417X=485
W417Y=205
W418X=485
W418Y=227
W419X=485
W419Y=244
W420X=485
W420Y=264
W421X=485
W421Y=283
W422X=485
W422Y=299
W424X=485
W424Y=319
W425X=485
W425Y=342
W426X=485
W426Y=358
W427X=485
W427Y=379
W428X=485
W428Y=398
W429X=485
W429Y=415
W430X=485
W430Y=435
W431X=485
W431Y=451
W432X=485
W432Y=474
W433X=485
W433Y=490
W434X=485
W434Y=516
W435X=573
W435Y=72
W436X=573
W436Y=90
W437X=573
W437Y=108
W438X=573
W438Y=131
W439X=573
W439Y=152
W440X=573
W440Y=170
W443X=573
W443Y=191
W444X=573
W444Y=205
W445X=573
W445Y=227
W446X=573
W446Y=244
W447X=573
W447Y=264
W448X=573
W448Y=283
W449X=573
W449Y=299
W450X=573
W450Y=319
W451X=573
W451Y=342
W452X=573
W452Y=358
W453X=573
W453Y=379
W454X=573
W454Y=398
W455X=573
W455Y=415
W456X=573
W456Y=435
W457X=573
W457Y=451
W458X=573
W458Y=474
W459X=573
W459Y=490
W463X=573
W463Y=516
W464X=670
W464Y=72
W465X=670
W465Y=90
W466X=670
W466Y=108
W467X=670
W467Y=131
W468X=670
W468Y=152
W469X=670
W469Y=170
W470X=670
W470Y=191
W471X=670
W471Y=205
W472X=670
W472Y=227
W473X=670
W473Y=244
W474X=670
W474Y=264
W475X=670
W475Y=283
W476X=670
W476Y=299
W477X=670
W477Y=319
W478X=670
W478Y=342
W479X=670
W479Y=358
W480X=670
W480Y=379
W481X=670
W481Y=398
W482X=670
W482Y=415
W483X=670
W483Y=435
W484X=670
W484Y=451
W485X=670
W485Y=474
W486X=670
W486Y=490
W487X=670
W487Y=516
W488X=570
W488Y=72
W489X=570
W489Y=90
W490X=570
W490Y=108
W491X=570
W491Y=131
W492X=570
W492Y=152
W493X=570
W493Y=170
W494X=570
W494Y=191
W495X=570
W495Y=205
W496X=570
W496Y=227
W497X=570
W497Y=244
W498X=570
W498Y=264
W499X=570
W499Y=283
W500X=570
W500Y=299
W501X=570
W501Y=319
W502X=570
W502Y=342
W503X=570
W503Y=358
W504X=570
W504Y=379
W505X=570
W505Y=398
W506X=570
W506Y=415
W507X=570
W507Y=435
W508X=570
W508Y=451
W509X=570
W509Y=474
W510X=570
W510Y=490
W511X=570
W511Y=516
W512X=663
W512Y=72
W513X=663
W513Y=90
W514X=663
W514Y=108
W515X=663
W515Y=131
W516X=663
W516Y=152
W517X=663
W517Y=170
W518X=663
W518Y=191
W519X=663
W519Y=205
W520X=663
W520Y=227
W521X=663
W521Y=244
W522X=663
W522Y=264
W523X=663
W523Y=283
W524X=663
W524Y=299
W525X=663
W525Y=319
W526X=663
W526Y=342
W527X=663
W527Y=358
W528X=663
W528Y=379
W529X=663
W529Y=398
W530X=663
W530Y=415
W531X=663
W531Y=435
W532X=663
W532Y=451
W533X=663
W533Y=474
W534X=663
W534Y=490
W535X=663
W535Y=516

key=0
bigkey=0
Loop, %id%
{
key++
this_id := id%A_Index%
WinGetTitle, Title, ahk_id %this_id%
if Title = RuneLite
{
WinActivate, ahk_id %this_id%
;WinMove, ahk_id %this_id%, , 1330,434, 781, 542
WinMove, ahk_id %this_id%,,,, 781, 542
Sleep, 2000
WinGetPos, X, Y, Width, Height, ahk_id %this_id%
MouseClick, left, 46, 512
Sleep, 800
if key = 1
MouseClick, left, %W301X%, %W301Y%
else if key = 2
MouseClick, left, %W308X%, %W308Y%
else if key = 3
MouseClick, left, %W316X%, %W316Y%
else if key = 4
MouseClick, left, %W326X%, %W326Y%
else if key = 5
MouseClick, left, %W335X%, %W335Y%
else if key = 6
MouseClick, left, %W371X%, %W371Y%
else if key = 7
MouseClick, left, %W379X%, %W379Y%
else if key = 8
MouseClick, left, %W380X%, %W380Y%
else if key = 9
MouseClick, left, %W382X%, %W382Y%
else if key = 10
MouseClick, left, %W383X%, %W383Y%
else if key = 11
MouseClick, left, %W384X%, %W384Y%
else if key = 12
MouseClick, left, %W393X%, %W393Y%
else if key = 13
MouseClick, left, %W394X%, %W394Y%
else if key = 14
MouseClick, left, %W397X%, %W397Y%
else if key = 15
MouseClick, left, %W398X%, %W398Y%
else if key = 16
MouseClick, left, %W399X%, %W399Y%
else if key = 17
MouseClick, left, %W418X%, %W418Y%
else if key = 18
MouseClick, left, %W425X%, %W425Y%
else if key = 19
MouseClick, left, %W426X%, %W426Y%
else if key = 20
MouseClick, left, %W430X%, %W430Y%
else if key = 21
MouseClick, left, %W431X%, %W431Y%
else if key = 22
MouseClick, left, %W433X%, %W433Y%
else if key = 23
MouseClick, left, %W434X%, %W434Y%
else if key = 24
MouseClick, left, %W435X%, %W435Y%
else if key = 25
MouseClick, left, %W436X%, %W436Y%
else if key = 26
MouseClick, left, %W437X%, %W437Y%
else if key = 27
MouseClick, left, %W438X%, %W438Y%
else if key = 28
MouseClick, left, %W439X%, %W439Y%
else if key = 29
MouseClick, left, %W440X%, %W440Y%
else if key = 30
MouseClick, left, %W451X%, %W451Y%
else if key = 31
MouseClick, left, %W452X%, %W452Y%
else if key = 32
MouseClick, left, %W453X%, %W453Y%
else if key = 33
MouseClick, left, %W454X%, %W454Y%
else if key = 34
MouseClick, left, %W455X%, %W455Y%
else if key = 35
MouseClick, left, %W456X%, %W456Y%
else if key = 36
MouseClick, left, %W457X%, %W457Y%
else if key = 37
MouseClick, left, %W458X%, %W458Y%
else if key = 38
MouseClick, left, %W459X%, %W459Y%
else if key = 39
MouseClick, left, %W469X%, %W469Y%
else if key = 40
MouseClick, left, %W470X%, %W470Y%
else if key = 41
MouseClick, left, %W471X%, %W471Y%
else if key = 42
MouseClick, left, %W472X%, %W472Y%
else if key = 43
MouseClick, left, %W473X%, %W473Y%
else if key = 44
MouseClick, left, %W474X%, %W474Y%
else if key = 45
MouseClick, left, %W475X%, %W475Y%
else if key = 46
MouseClick, left, %W476X%, %W476Y%
else if key = 47
MouseClick, left, %W483X%, %W483Y%
else if key = 48
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W497X%, %W497Y%
}
else if key = 49
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W498X%, %W498Y%
}
else if key = 50
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W499X%, %W499Y%
}
else if key = 51
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W500X%, %W500Y%
}
else if key = 52
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W501X%, %W501Y%
}
else if key = 53
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W502X%, %W502Y%
}
else if key = 54
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W503X%, %W503Y%
}
else if key = 55
{
;Right Button
MouseClick, left, 740, 280
Sleep, 500
;Right Button
MouseClick, left, 740, 280
Sleep, 500
MouseClick, left, %W504X%, %W504Y%
key = 0
}
}
}
return

Mouse info toggle

Mouse info toggle

^#F5::
key++
if key = 1
{
#Persistent
SetTimer, WatchCursor, 100

WatchCursor:
;CoordMode, ToolTip, Screen  ; Place ToolTips at absolute screen coordinates.
MouseGetPos, xpos, ypos, id, control
MouseGetPos, xposs, yposs 
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control% xPos: %xpos% yPos: %ypos% xPoss: %xposs% yPoss: %yposs%
return
}
if key = 2
Reload
return

Enter username and password on logged out RuneLite clients

Enter username and password on logged out RuneLite clients

#!F6::
if(WinExist("Agonic Blade - RuneLite.exe"))
{
WinGetTitle, Title, ahk_exe Agonic Blade - RuneLite.exe
if Title = RuneLite
{
WinActivate, ahk_exe Agonic Blade - RuneLite.exe
Sleep 250
Send, {enter}
Sleep 950
Send, enter email or username here{enter}enterpasswordhere
Sleep 200
}
}
if(WinExist("ahk_exe Antic Blade - RuneLite.exe"))
{
WinGetTitle, Title, ahk_exe Antic Blade - RuneLite.exe
if Title = RuneLite
{
WinActivate, ahk_exe Antic Blade - RuneLite.exe
Sleep 250
Send, {enter}
Sleep 950
Send, enter email or username here{enter}enterpasswordhere
Sleep 200
}
}
return

Enter username and password on active window with warning prompt

Enter username and password on active window with warning prompt

^#F6::
WinGet, Active_ID, ID, A
WinGet, Active_Process, ProcessName, ahk_id %Active_ID%
MsgBox, 4,, You're about to enter your username & password (press Yes or No)

IfMsgBox No
return

IfMsgBox Yes
{
if Active_Process = Agonic Blade - RuneLite.exe
{
Sleep 250
Send, {enter}
Sleep 950
Send, enter email or username here{enter}enterpasswordhere
Sleep 200
}

if Active_Process = Heroic Blade - RuneLite.exe
{
Sleep 250
Send, {enter}
Sleep 950
Send, enter email or username here{enter}enterpasswordhere
Sleep 200
}
}
return

Start multiple clients with 1 button (checks to see if client is already open)

Start multiple clients with 1 button (checks to see if client is already open)

+#F1::
if !(WinExist("ahk_exe Agonic Blade - RuneLite.exe"))
{
SetTitleMatchMode = 2
Run, C:\Users\%A_Username%\AppData\Local\RuneLite\Agonic Blade - RuneLite.exe
Sleep 100
}
if !(WinExist("ahk_exe Antic Blade - RuneLite.exe"))
{
SetTitleMatchMode = 2
Run, C:\Users\%A_Username%\AppData\Local\RuneLite\Antic Blade - RuneLite.exe
Sleep 100
}
return

Reposition RuneLite clients

Reposition RuneLite clients

#!F10::
WinGet, id, list, RuneLite
bigkey=0
Loop, %id%
{
this_id := id%A_Index%
key++
WinMove, ahk_id %this_id%, , -1087+((key-1)*1084),-3055+(bigkey*612), 1100, 618
WinGetPos, X, Y, Width, Height, A
if key = 5
{
bigkey++
key = 0
}
if bigkey = 5
bigkey = 0
}
return

Description coming soon.

Get Active Window Stats

!#+^F12::
WinGetActiveStats, winT, winW, winH, winX, winY
MsgBox, % "Title of active window:`n" winT "`n`nCoords start at:`nx" winX ", y" winY "`n`nWidth x Height:`n" winW " x " winH
return

Customizing the hotkeys in the script

You define the hotkey of an AHK script before the “::” symbol.

In my code example below the hotkey is assigned to “#!F12::” #=Windows button, !=Alt, F12=F12. So to active the script between “#!F12::” and “Return” you have to press Windows + Alt + F12.
Let’s say you want to assign the hotkey to Shift+Alt+H, then you replace “#!F12::” with “+!H”. As +=Shift and !=Alt.

Code Example

#!F12::
Send, I just pressed Windows + Alt + F12
return

For reference I’ve added the most used hotkey modifier symbols below:

#=Windows logo key
!=Alt
^=Control
+=Shift
For more info on hotkey modifiers refer to this webpage.