IF ISVISIBLE "window_title"

#1
In another forum, a user wants to send input (with KEYSTACK) to a window of a newly STARTed app. ISWINDOW "title" is true almost immediately, but it's another 8 seconds before the window is visible (and accepts input). An ISVISIBLE "title" conditional expression would be handy here.

For fun, I worked around it with the following.
Code:
start Capture4Me.exe
set visible=0
do while %visible == 0
    delay /m 500
    set hwnd=%@WINAPI[user32,FindWindowEx,0,0,0,Capture4Me]
    iff %hwnd NE 0 then
        set visible=%@winapi[user32,IsWindowVisible,%hwnd]
    endiff
enddo
keystack ...
 
#3
OK, thanks. I'm doing this and seeing what looks like a bug.
Code:
start Capture4Me.exe
do while not iswindow "Capture4Me" ( delay /m 500 )
activate "Capture4Me"
keystack /i"Capture4Me",10000 Tab [5] Enter
::keystack /i"Capture4Me",10000 Tab Tab Tab Tab Tab Enter
I only see evidence of one Tab being sent to the window (and in that state, I can't tell if Enter was sent). There is a space after Tab.

If I use, instead, the commented line it works as desired ... 5 tabs take me to the "Record" button and Enter results in an error message to the effect that I must first start a device.

And, is the ACTIVATE of any value when the window hasn't yet been shown?
 
#5
You can test it with Notepad. "Tab [5] Enter" works without the /i option and this code
Code:
start notepad
do while not iswindow "Untitled - Notepad" ( delay /m 500 )
activate "Untitled - Notepad"
keystack /i"Untitled - Notepad",10000 Tab [5] Enter
results in

1534093515063.png