Created
October 14, 2025 11:44
-
-
Save JoeGlines/65f991f34a43ba1d7d20889be6cb1881 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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