This document provides practical examples and common usage patterns for the scripts in this repository.
Use Case: Make any game fullscreen without borders
; ahk/Fullscreen.ahk
#Requires AutoHotkey v2.0
#Include A_ScriptDir "\..\Lib\v2\WindowManager.ahk"
; Press End key to toggle borderless fullscreen on active window
End::ToggleFakeFullscreenMultiMonitor("A")Usage:
- Run
Fullscreen.ahk - Focus on your game window
- Press
Endkey - Press
Endagain to restore
Use Case: Snap windows to screen edges like Windows 11
; From Keys.ahk - Window snapping with Win+Arrow keys
#Left:: ; Win+Left - Snap to left half
WinGetPos(&X, &Y, &Width, &Height, "A")
WinMove(0, 0, A_ScreenWidth/2, A_ScreenHeight, "A")
Return
#Right:: ; Win+Right - Snap to right half
WinGetPos(&X, &Y, &Width, &Height, "A")
WinMove(A_ScreenWidth/2, 0, A_ScreenWidth/2, A_ScreenHeight, "A")
ReturnUse Case: Keep a window on top of all others
; Toggle always-on-top for active window
^Space:: ; Ctrl+Space
WinSetAlwaysOnTop(-1, "A") ; -1 = toggle
MsgBox("Always on top toggled!")
ReturnUse Case: Automatically launch Citra in fullscreen
Method 1: Using AutoStartManager
# Run with emulator name
Other/AutoStartManager.ahk CitraMethod 2: Manual Script
#Requires AutoHotkey v2.0
#Include A_ScriptDir "\..\Lib\v2\AutoStartHelper.ahk"
; Wait for Citra, then press F11 for fullscreen
AutoStartFullscreen("citra-qt.exe", "{F11}", true, 0)Use Case: Apply HD textures for Zelda: Ocarina of Time
#Include %A_ScriptDir%\tf.ahk
global CitraConfigFile := A_AppData . "\Citra\config\qt-config.ini"
; Enable HD Textures
tf_Replace(CitraConfigFile, "custom_textures\use_custom_textures=false", "custom_textures\use_custom_textures=true")
; Set 4x resolution
tf_Replace(CitraConfigFile, "resolution_factor\default=true", "resolution_factor\default=false")
tf_Replace(CitraConfigFile, "resolution_factor=1", "resolution_factor=4")
MsgBox("Configuration applied for Zelda OOT!")
ExitAppUse Case: Auto-switch monitors when launching Playnite
# Run Playnite with multi-monitor automation
Other/Playnite_fullscreen_v2/Playnite_TV.ahkThis automatically:
- Disables secondary monitor
- Switches primary monitor
- Launches Playnite fullscreen
- Plays boot video
- Restores on exit
Use Case: Auto-fish while AFK
#Requires AutoHotkey v2.0
F7:: { ; Start fishing macro
Loop {
Send("{Mouse2}") ; Cast rod
Sleep(RandomDelay(15000, 20000)) ; Wait for bite
Send("{Mouse2}") ; Reel in
Sleep(RandomDelay(1000, 2000)) ; Delay before next cast
}
}
F8::Pause ; Pause/Resume
F9::ExitApp ; Stop
RandomDelay(min, max) {
return Random(min, max)
}Usage:
- Position yourself at fishing spot
- Hold fishing rod
- Run script and press F7
- F8 to pause, F9 to stop
Use Case: AFK XP grinding in Zombies
#Requires AutoHotkey v2.0
F7:: { ; Start XP macro
Loop {
; Move in circle to avoid AFK kick
Send("{w down}")
Sleep(500)
Send("{w up}")
Sleep(100)
; Shoot periodically
Send("{Mouse1}")
Sleep(RandomDelay(800, 1200))
; Anti-AFK movement every 30 seconds
if (Mod(A_Index, 30) == 0) {
Send("{Space}") ; Jump
Sleep(200)
}
}
}
F8::Pause
F9::ExitApp
RandomDelay(min, max) {
return Random(min, max)
}Use Case: Launch multiple scripts from one GUI
#Requires AutoHotkey v2.0
global script1PID := 0
global script2PID := 0
; Create GUI
myGui := Gui("+AlwaysOnTop", "Script Launcher")
; Add buttons
myGui.Add("Button", "w200", "Launch Fullscreen").OnEvent("Click", LaunchFullscreen)
myGui.Add("Button", "w200", "Launch Power Plan").OnEvent("Click", LaunchPowerPlan)
myGui.Add("Button", "w200", "Close All Scripts").OnEvent("Click", CloseAll)
myGui.Show()
; Button handlers
LaunchFullscreen(*) {
global script1PID
Run(A_ScriptDir "\Fullscreen.ahk", , , &script1PID)
}
LaunchPowerPlan(*) {
global script2PID
Run(A_ScriptDir "\Powerplan.ahk", , , &script2PID)
}
CloseAll(*) {
if WinExist("ahk_pid " script1PID)
WinClose("ahk_pid " script1PID)
if WinExist("ahk_pid " script2PID)
WinClose("ahk_pid " script2PID)
}Use Case: Download entire playlist as MP3s
# 1. Place yt-dlp.exe in Other/Downloader/
# 2. Run YT_Spotify_Downloader.ahk
# 3. Paste playlist URL
# 4. Select "Audio - MP3"
# 5. Click DownloadManual command line:
cd Other/Downloader
yt-dlp -f "ba" -x --audio-format mp3 "https://youtube.com/playlist?list=..."Use Case: Download Spotify playlist to local files
# 1. Place spotdl.exe in Other/Downloader/
# 2. Run YT_Spotify_Downloader.ahk
# 3. Paste Spotify playlist URL
# 4. Click DownloadManual command line:
cd Other/Downloader
spotdl "https://open.spotify.com/playlist/..."Use Case: Switch to High Performance when game launches
#Requires AutoHotkey v2.0
; Monitor for specific game
processName := "FortniteClient-Win64-Shipping.exe"
highPerfGUID := "{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}"
balancedGUID := "{381b4222-f694-41f0-9685-ff5bb260df2e}"
SetTimer(CheckProcess, 5000)
CheckProcess() {
if ProcessExist(processName) {
; Switch to High Performance
Run("powercfg /setactive " highPerfGUID, , "Hide")
} else {
; Switch to Balanced
Run("powercfg /setactive " balancedGUID, , "Hide")
}
}Use Case: Quit games with controller combo
#Requires AutoHotkey v2.0
; Guide + Start + B to close active window
; (Implementation varies by controller library)
; Simple version using keyboard simulation
^!q:: ; Ctrl+Alt+Q as alternative
if WinExist("A") {
WinClose("A")
}
ReturnUse Case: Copy all images from vacation photos to backup
@echo off
REM Copy_vacation_photos.cmd
set ext=*.jpg *.jpeg *.png *.heic *.raw
robocopy "D:\Vacation 2024" "E:\Backup\Vacation 2024" %ext% /s /MT:32 /v
echo.
echo Copy complete!
pauseUse Case: Compress PS2 games to save space
# Compress with maximum compression
7z a -t7z -mx=9 "God of War.7z" "God of War\*"
# Then use with 7zEmuPrepper for on-the-fly extractionUse Case: Complete emulator setup automation
#Requires AutoHotkey v2.0
#Include A_ScriptDir "\..\Lib\v2\AHK_Common.ahk"
#Include A_ScriptDir "\..\Lib\v2\WindowManager.ahk"
InitScript(false, true) ; Require admin
; 1. Apply per-game config
Run("Citra_per_game_config\Pokemon-X.ahk")
Sleep(2000)
; 2. Launch emulator
citraPath := "C:\Emulators\Citra\citra-qt.exe"
gamePath := "D:\Games\3DS\Pokemon X.3ds"
Run('"' citraPath '" "' gamePath '"', , , &citraPID)
; 3. Wait and apply fullscreen
if WaitForProcess("citra-qt.exe", 10) {
Sleep(2000)
Send("{F11}") ; Fullscreen
}Use Case: Different settings for different times of day
#Requires AutoHotkey v2.0
currentHour := A_Hour
if (currentHour >= 22 or currentHour < 6) {
; Night mode - reduce volume
SoundSetVolume(30)
MsgBox("Night mode activated")
} else {
; Day mode - normal volume
SoundSetVolume(70)
MsgBox("Day mode activated")
}Use Case: Robust script with error recovery
#Requires AutoHotkey v2.0
try {
; Try to launch emulator
if !FileExist("emulator.exe") {
throw Error("Emulator not found!")
}
Run("emulator.exe", , , &pid)
; Wait for window
if !WinWait("ahk_pid " pid, , 10) {
throw Error("Window did not appear!")
}
; Success
MsgBox("Emulator launched successfully!")
} catch as e {
; Handle error
MsgBox("Error: " e.Message, "Error", "Icon!")
ExitApp(1)
}Always test with /L flag for file operations:
REM Preview robocopy without copying
robocopy source dest /s /MT:32 /L; Add debug output
MsgBox("Debug: Variable = " myVariable)
; Or use ToolTip for non-blocking
ToolTip("Debug: Step 1 complete")
Sleep(2000)
ToolTip() ; ClearAdd to scripts for easy reloading:
^r::Reload ; Ctrl+R to reload script
^e::Edit ; Ctrl+E to edit script- README.md - Main documentation
- CLAUDE.md - Developer guide with detailed patterns
- CONTRIBUTING.md - Contribution guidelines
- AutoHotkey v2 Documentation
Last Updated: 2025-12-26