Just for info
I recently tried to get my compiled AHK to run from a Windows 7 scheduled task, but it kept failing to run.
I could run other compiled programs I had written OK.
This was driving me mad, until I looked into the script that was running, and the one that wasn't.
It turned out to be 3 lines of code missing at the begininning of script:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Inserted the above, and all ran as exspected.
Strange, I could run the program on it's own, but the scheduler wouldn't like it.
Now everything works fine.
I hope it might help other people.