I'm sorry for bringing old topics back to life,
but after using @DW1's script and try to do a run after it opens notepad.exe it won't load the program.
This is what I'm doing:
$StartTimer = TimerInit() ; Define the initial time we will be comparing to later
$process = "notepad.exe" ; define the process
$exe = @SystemDir & "\notepad.exe" ; Define the executable
Checkprocess() ; Run our checkprocess() function on initial execute
While 1 ; Infinite Loop C