Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created October 14, 2025 11:44
Show Gist options
  • Save JoeGlines/65f991f34a43ba1d7d20889be6cb1881 to your computer and use it in GitHub Desktop.
Save JoeGlines/65f991f34a43ba1d7d20889be6cb1881 to your computer and use it in GitHub Desktop.
#Requires AutoHotkey v2.0.2+
#SingleInstance Force
DetectHiddenWindows true
readConfigFile(fileName) {
try {
fileObj := FileOpen(fileName, "r")
if !fileObj {
throw Error("Could not open file")
}
content := fileObj.Read()
fileObj.Close()
return content
} catch as err {
throw Error("Failed to read config: " . err.Message)
}
}
; Use the function
try {
content := readConfigFile("config.txt")
MsgBox("Config: " . content)
} catch as err {
MsgBox("Error: " . err.Message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment