KEYSTACK and someone else's MessageBox?

May 20, 2008
11,810
118
Syracuse, NY, USA
I want to automate pressing "Y" when my editor prompts "OK to create ..." with a message box. Here's my attempt so far, TPAD.BTM.

Code:
::TPAD.BTM
setlocal
echo on
set noexist=0

do i=1 to %#
    if not exist %[%i] set noexist=%@eval[%noexist + 1]
enddo

d:\TextPad7\TextPad.exe %$

iff %noexist GT 0 then
    do i=1 to %noexist
        keystack /w18 "Y"
    enddo
endiff

If I issue tpad.btm xx1.txt xx2.txt (both files non-existent), I see

Code:
set noexist=0
do i=1 to %#
if not exist %[%i] set noexist=%@eval[%noexist + 1]
if not exist %[%i] set noexist=%@eval[%noexist + 1]
d:\TextPad7\TextPad.exe xx1.txt xx2.txt

The first message box appears and that's it! The BTM doesn't continue until I have (manually) dismissed both message boxes and the keystrokes wind up in one of the documents. What's going on there? Is there anything I can do about it?
 
May 20, 2008
11,810
118
Syracuse, NY, USA
It's easy enough to work around ... either build and execute the KEYSTACK command before starting TEXTPAD, or forget KEYSTACK and simply create the files (TOUCH /C /Q) before starting TEXTPAD.

But I'm still wondering how the execution of the BTM was suspended in my original approach.
 

Similar threads