"Post-Include" command.
Posted: 14 Dec 2017, 08:19
I don't really know what I'm thinking, I just feel that AHK should have some sort of command/function to "post-include" a script into a compiled script.
So, similar to FileInstall, it would load the file, if said file is in the directory specified, the compiled script then loads it and uses it, but it'd only load into the script upon starting, not conditional. However, I think that, if the file could not load in the file (Whether file format is different such as Unicode vs ASCII, or the file isn't in the AHK syntax language) it would return ErrorLevel where the script could work off of it and do something, or display a message, etc etc.
The way I think it should work as to not throw a bunch of errors would be:
It's just something that I would think would be quite useful, esspecially for plugins or just allowing users to customize certain variables without having to include a library to read from a certain type of file like XML or JSON, or having to use IniRead which already is a little "wonky" when it comes to loading in UTF-8 files.
If you have any suggestions on this, comments, or even criticisms, please do reply!
So, similar to FileInstall, it would load the file, if said file is in the directory specified, the compiled script then loads it and uses it, but it'd only load into the script upon starting, not conditional. However, I think that, if the file could not load in the file (Whether file format is different such as Unicode vs ASCII, or the file isn't in the AHK syntax language) it would return ErrorLevel where the script could work off of it and do something, or display a message, etc etc.
The way I think it should work as to not throw a bunch of errors would be:
Code: Select all
/*
Plugin.ahk would be...
MsgBox, Hello there!
If (A_ScriptName = "Plugin.ahk") {
x := y
}
*/
PostInclude, Plugin.ahk, UseErrorLevel
If (InStr(A_LastError, "Error Loading File")) { ; If the file could not be loaded...
MsgBox, 16, Error!
, % "There was an error loading the file, said file could not be loaded into the program, ""Plugin.ahk"""
ExitApp
}
Some_Function_That_Executes_AFTER_Script_Executes()
If you have any suggestions on this, comments, or even criticisms, please do reply!