code starts timer > runs notepad > after 2 sec closes notepad (should work with any window title or ahk_??? window title parameter)
Below is the code (added #Persistent per Wolf_II post)...
Code: Select all
#Persistent
CloseWindow("Untitled - Notepad",2000)
run notepad.exe
return
; the following Function & Timer can be in the main script or in a function library
CloseWindow(wTitle,DelayInMilSecs) ; CLOSES Window after Delay (MilSec)
{
global wTTC := wTitle
SetTimer, CloseWindow_Timer, % "-" . DelayInMilSecs
return
}
CloseWindow_Timer:
WinClose %wTTC%
Return