A do-loop is only broken by using the
exit keyword (or returning from a function / jumping to a label if you're in a situation where such is possible).
Pressing the escape key without previously calling
disable escapekey will cause it to terminate your application. If you disable it, pressing it will do nothing unless you tell it to, for example like so:
while not escapekey()
rem Do something
endwhile
Quote: "I am checking the escapekey in the loop. This is what exits the program."
I was talking about your first snippet, not the second
This works as intended:
AppNotepad as dword
AppNotepad = execute executable ("Notepad.exe","","")
sleep 1000
if executable running(AppNotepad)
stop executable AppNotepad
endif
If you remove the call to
sleep, the DBP program will finish before notepad has started, thus it won't be stopped.
After checking, I was incorrect in assuming
executable running would return false at this time; it doesn't. What seems to be happening is that
stop executable has no effect if it's called before the executable has started up properly.
"Why do programmers get Halloween and Christmas mixed up?" Because Oct(31) = Dec(25)