I have written a AutoHotkey script that works well uncompiled, but no matter which Base File (.bin) I use to compile the exe in Ahk2Exe, it fails for some unknown reason. Here's the AHK script:
SetTitleMatchMode, 2
WinGet, PID, PID, Anime Studio ahk_class LM_Wnd
Process, Close, %PID%
if 1 && (%ErrorLevel% != 0)
{
Run, %1%
}
And here's how I'm running it, from a Lua script (double-quotes are for spaces in actual paths):
--to uncompiled AHK (working code)
os.execute("C:/Users/JWesley/Desktop/AutoHotkey/AutoHotkeyU64.exe ".."\"".."C:/Users/JWesley/Files/AS/Anime Studio Pro/scripts/utility/ReopenAS.ahk".."\"".." "..path)
--to compiled AHK (not working)
os.execute("\"".."C:/Users/JWesley/Files/AS/Anime Studio Pro/scripts/utility/ReopenAS64.exe".."\"".." "..path)
I'm passing the variable "path" from Lua to the AHK script (%1%). I've tried setting the AHK compiled exe to Run As Administrator, but that didn't help.
path = "C:/Users/JWesley/Desktop/test.anime"
I've tried using os.execute('pause') so that I have a chance to read any command prompt messages, but the first one still closes before the paused one opens. EDIT: Okay, I got this to leave the prompt open:
os.execute("cmd.exe /k"..'"C:\\Users\\JWesley\\Desktop\\AutoHotkey\\AutoHotkeyU64.exe" "C:\\Users\\JWesley\\Files\\AS\\Anime Studio Pro\\scripts\\utility\\ReopenAS.ahk" "' .. path .. '"')
And got this message in the prompt:
The filename, directory name, or volume label syntax is incorrect.
path
? Is it relative? Maybe the problem is that the executable file is in a different directory (uncompiled:C:\AutoHotkey
, compiled:C:\
)? – CherryDT'
s doesn't need to escape"
s. – user6245072