Could not close the previous instance of this script. Keep waiting? Topic is solved
Could not close the previous instance of this script. Keep waiting?
Why do I get this and how do I avoid it?
Re: Could not close the previous instance of this script. Keep waiting? Topic is solved
If you run a script that is already running, it might occur. You could try #SingleInstance Force.
Re: Could not close the previous instance of this script. Keep waiting?
I use that in every script. I get this after I have edited a script for the second time or more and then reload it. From what I've read, people have implemented into their scripts:
- Process, Close, % varThread
- WinClose, % "ahk_pid " . varThread
- WinWaitClose, % "ahk_pid " . varThread,, 2 ; Waits up to 2 seconds
- onexit,exiting
- SetWinDelay, 0 ; executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it.