You need to tell your script to wait for the process to close using the process command. Process, WaitClose, farscape.exe Something like that. I'm more familiar with autoit so I could be wrong so maybe one of the ahk scripters here can jump in if i'm wrong. Just take a look here for reference.