diff --git a/docs/index.html b/docs/index.html
index b4fa4fc..f0aed63 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1581,6 +1581,10 @@
A_AhkVersion
# In versions prior to 1.0.22, this variable is blank. Otherwise, it contains the version of AutoHotkey that is running the script, such as 1.0.22. In the case of a compiled script, the version that was originally used to compile it is reported. Always contains 1.0.24. |
+
+ A_IsCompiled |
+ #Contains 1 if the script is running as a compiled EXE and an empty string (which is considered false) if it is not. |
+
A_ExitReason |
# The most recent reason the script was asked to terminate. This variable is blank unless the script has an OnExit subroutine and that subroutine is currently running or has been called at least once by an exit attempt. See OnExit for details. |
diff --git a/src/ahk_x11.cr b/src/ahk_x11.cr
index 9044425..565ccd8 100644
--- a/src/ahk_x11.cr
+++ b/src/ahk_x11.cr
@@ -59,6 +59,7 @@ end
script_file = nil
version = {{ read_file("./shard.yml").split("\n")[1][9..] }}
lines = Compiler.new.extract.try &.split('\n')
+is_compiled = !! lines
if ! lines
# Only needed for installer script, this can't (yet) really be part of ahk code. TODO: rm on exit
File.write("/tmp/tmp_ahk_x11_logo.png", logo_blob)
@@ -104,7 +105,7 @@ rescue e : Build::SyntaxException | Build::ParsingException
end
begin
- runner = Run::Runner.new builder: builder, script_file: script_file, headless: HEADLESS
+ runner = Run::Runner.new builder: builder, script_file: script_file, is_compiled: is_compiled, headless: HEADLESS
runner.run
rescue e : Run::RuntimeException
build_error e
diff --git a/src/run/runner.cr b/src/run/runner.cr
index d5ed334..1bd3869 100644
--- a/src/run/runner.cr
+++ b/src/run/runner.cr
@@ -62,6 +62,7 @@ module Run
property current_input_channel : Channel(String)?
@builder : Build::Builder
getter script_file : Path?
+ getter is_compiled : Bool
getter headless : Bool
@display : Display?
def display
@@ -69,7 +70,7 @@ module Run
@display.not_nil!
end
- def initialize(*, @builder, @script_file, @headless)
+ def initialize(*, @builder, @script_file, @is_compiled, @headless)
@labels = @builder.labels
@settings = @builder.runner_settings
script = @script_file ? @script_file.not_nil! : Path[binary_path].expand
@@ -257,6 +258,7 @@ module Run
when "a_isadmin" then Hacks.username == "root" ? "1" : "0"
when "a_computername" then `uname -n`
when "a_issuspended" then @suspension ? "1" : "0"
+ when "a_iscompiled" then @is_compiled ? "1" : ""
when "0" then (ARGV.size - (@script_file ? 1 : 0)).to_s
else
if i = var.to_i?