I had done some work that might help, originally it was for a server but can be done with anything. I wanted to detect if an exe was running and then have the app close itself when the exe closed so I compiled this script with autohotkey:
#Persistent
run FPSCGame.exe ; execute your game with this program
IniWrite, 1, IO.ini, app, on
WinWait, FPSC Game ; watch the FPSC Game window
WinWaitClose ; wait for it to close
IniDelete, IO.ini
ExitApp ; then exit this app
Return
then named it IO.exe
then in gamemaker or other language find your file exist command and do something like this
if file_exists('IO.ini') = 0
{
do something that you want
}
if its gamemaker then you'll have to put that in an alarm and call it every 5 seconds or so, if basic, well.. loop it.
if thats no help then forget I ever typed anything.