Done IF ISVISIBLE "window_title"

May 20, 2008
10,498
77
Syracuse, NY, USA
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 ...
 
May 20, 2008
10,498
77
Syracuse, NY, USA
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?
 

rconn

Administrator
Staff member
May 14, 2008
11,894
133
The ACTIVATE is probably useless.

The Tab [5] issue isn't a TCC / KEYSTACK problem (works fine here on other apps). The only difference between your two lines is the speed at which KEYSTACK sends the tabs. Apparently "Capture4Me" can't handle fast input.
 
May 20, 2008
10,498
77
Syracuse, NY, USA
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