Note: Newbee at this so let me know if this script needs improvement.
Simple automation to check if notepad is open or not.
cls ; clear the screen
color w+/n
? "Running the automation test program, please wait....."
color g+/n
? "Currently looking for your notepad program located at: "
color b+/w
?
Break
onRun "%SystemRoot%\System32\notepad.exe"
While SetFocus ("Untitled - Notepad") <> 0
Sleep 1
$Index = $Index + 1
if $index > 3
Run "%SystemRoot%\system32\notepad.exe"
color w+/n
? "Opening Notepad......"
Sleep 1
SetFocus ("Untitled - Notepad")
$_ SendKeys("Hello " + @fullname + ", I noticed you do not have notepad open, so I opened it for you.{Enter}")
$_ SendKeys("{Tab}Minimize the notepad and run the application again please...");
Exit
GOSUB "Demo"
endif
Loop
color w+/n
? "Notepad is already open......"
$_ = SendKeys("{Enter}{Enter}Hey look you have notepad still open, Thanks!!!.")
Exit
:Demo
get $_
Exit
Return