#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. PrevButton := 1 NewButton := 0 Joy28:: NewButton := 1 ProcessKeys() return Joy29:: NewButton := 2 ProcessKeys() return Joy30:: NewButton := 3 ProcessKeys() return ProcessKeys() { global local dif := (PrevButton - NewButton) local times := Abs(dif) if (dif > 0) { Send {PgDn %times% } } else if (dif < 0) { Send {PgUp %times% } } PrevButton := (NewButton) }