ACTIVATE doesn't find windows

Apr 13, 2010
301
7
61
The Hague
After starting a process I would like to change the window title to contain a process number.

START "Job starting ..." /PGM "%_CMDSPEC" /C etc<ETC>

and then

ACTIVATE "Job*" MIN "Job - %_STARTPID"

Returns the error message: Window title not found "Job*"
and of course the job window is not minimized.

What am I doing wrong?

DJ
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- Original Message -----
From: "djspits" <>
Subject: [Support-t-2004] ACTIVATE doesn't find windows



> After starting a process I would like to change the window title to
> contain a process number.
>
> START "Job starting ..." /PGM "%_CMDSPEC" /C <etc>
>
> and then
>
> ACTIVATE "Job*" MIN "Job - %_STARTPID"
>
> Returns the error message: Window title not found "Job*"
> and of course the job window is not minimized.
>
> What am I doing wrong?

In help topic activate.htm you find this warning:

"Each execution of ACTIVATE allows you to modify one property of the target
window. To perform multiple operations, use multiple ACTIVATE commands."

You tried to do two actions: 1/ window size change and 2/ title change...
--
HTH, Steve
 
Apr 13, 2010
301
7
61
The Hague
Thanks for the reply, Steve.

You're quite right and I removed the MIN.
But still no luck.
I've tried everything I can think of.

Here's my code again

Code:
START "Starting" /PGM "%_CMDSPEC" /IS /IX /IP /C "[EMAIL="%@UNQUOTE"]%@UNQUOTE[/EMAIL][%executable]"
SET new_title=Executing %_STARTPID
ACTIVATE "Starting" "%new_title"
UNSET new_title
ECHO Started: %executable as %_STARTPID
DELAY 3

The delay is there because I also read in the helptext that the lifespan of
a new title is limitted to the lifespan of the changing batch? Is that correct?

Looking forward to your comment.

DJ
 
May 20, 2008
11,379
98
Syracuse, NY, USA
TCC changes its own title almost immediately after startup.

On Mon, 31 May 2010 11:37:56 -0400, djspits <> wrote:

|Thanks for the reply, Steve.
|
|You're quite right and I removed the MIN.
|But still no luck.
|I've tried everything I can think of.
|
|Here's my code again
|
|
|Code:
|---------
|
|START "Starting" /PGM "%_CMDSPEC" /IS /IX /IP /C "%@UNQUOTE[%executable]"
|SET new_title=Executing %_STARTPID
|ACTIVATE "Starting" "%new_title"
|UNSET new_title
|ECHO Started: %executable as %_STARTPID
|DELAY 3
|---------
|
|The delay is there because I also read in the helptext that the lifespan of
|a new title is limitted to the lifespan of the changing batch? Is that correct?
|
|Looking forward to your comment.
|
|DJ
|
|
|
|
--
- Vince
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- Original Message -----
From: "djspits" <>
To: <ESFabian@comcast.net>
Sent: 2010. May 31., Monday 11.37
Subject: RE: [Support-t-2004] Re: ACTIVATE doesn't find windows


| Thanks for the reply, Steve.
|
| You're quite right and I removed the MIN.
| But still no luck.
| I've tried everything I can think of.
|
| Here's my code again
|
|
| Code:
| ---------
|
| START "Starting" /PGM "%_CMDSPEC" /IS /IX /IP /C "%@UNQUOTE[%executable]"
| SET new_title=Executing %_STARTPID
| ACTIVATE "Starting" "%new_title"
| UNSET new_title
| ECHO Started: %executable as %_STARTPID
| DELAY 3
| ---------
|
| The delay is there because I also read in the helptext that the lifespan
of
| a new title is limitted to the lifespan of the changing batch? Is that
correct?

As Vince wrote, UNLESS you use directive UpdateTitle=No (one of the entries
in the Startup page of the OPTION dialog) the title will change rapdily,
ACTIVATE may not find it. However, its TCSTART file can issue a TITLE
command to set its own title to include its PID (and you must skip /IS
option; more below).

Vince's plugin sysutils.dll includes the WHICHWIN command, which (among
other things) can return the current title of a window when you have its
PID. You can use that to determine the title needed in the ACTIVATE command
if you do not want to use TCSTART.

Note that the suboptions of the /I option MUST be combined into a single
option, i.e., /IIPSX, not spread out as 3 separate arguments.

Last but not least: why do you need a spearate instance of TCC at all just
to run another program? It could be started directly with the START command.
--
HTH, Steve
 
Apr 13, 2010
301
7
61
The Hague
Steve,

I'm using START "%_cmdspec" because I'm running a batch. (Sorry about the misleading envar "executable").

OPTON UpdateTitle was already off but I added the explicit change just to put your mind at rest.

I changed the /I syntax. Thank you. Please add that to the helptext topic "TCC Startup Options".

I didn't understand Vince' remarks. Which window is changed by TCC immediately after startup?

However, it did make me wonder if perhaps the opposite was true. Namely that I was trying to catch a window that hasn't had it's default TCC title changed yet by START.

The following code now works.

Code:
OPTION //UpdateTitle=No
 
START "Job starting..." /PGM "%_CMDSPEC" /IPSX /C "%@UNQUOTE[%executable]"
DELAY 1
ACTIVATE "Job starting*" "Executing job %_STARTPID"
 
ECHO Started: %executable as %_STARTPID

I have two closing questions left:
1) Is the OPTION really necessary?
2) How would you implement a loop that waits for the window to become visible before using ACTIVATE to rename it? The DELAY seems a brittle solution.

Thx, DJ
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- Original Message -----
From: "djspits" <>
| I didn't understand Vince' remarks. Which window is changed by TCC
immediately after startup?

If the directive UpdateTitle is set to YES in TCC, it changes its own title
to match the command it currently executes by appending it to the original
title, and dropping ot when the command is completed. With your options
(i.e., ignore all startup controls, use parent's options) the time between
creating a new instance and executing the first command (which with the /C
option is the only command) is minimal.
|
| However, it did make me wonder if perhaps the opposite was true. Namely
that I was trying to catch a window that hasn't had it's default TCC title
changed yet by START.
|
| The following code now works.
|
|
| Code:
| ---------
|
| OPTION //UpdateTitle=No
|
| START "Job starting..." /PGM "%_CMDSPEC" /IPSX /C "%@UNQUOTE[%executable]"
| DELAY 1
| ACTIVATE "Job starting*" "Executing job %_STARTPID"
|
| ECHO Started: %executable as %_STARTPID
| ---------
|
| I have two closing questions left:
| 1) Is the OPTION really necessary?

I think not, because the (temporary) changes are appended to the title, so
the wildcard in the searched after title in ACTIVATE will find it anyway.
Furthermore, you can put the option into the START command itself, so your
interactive session can continue updating its own title:

START "Job starting..." /PGM "%_CMDSPEC" /IPSX //UpdateTitle=No /C
"%@UNQUOTE[%executable]"

| 2) How would you implement a loop that waits for the window to become
visible before using ACTIVATE to rename it? The DELAY seems a brittle
solution.

For that very reason at my request Vince added the WAITWIN command to his
sysutils.dll plugin. You can use that command instead. If you loaded the
plugin, use its SYSHELP command for more details.
--
HTH, Steve
 
May 20, 2008
11,379
98
Syracuse, NY, USA
On Wed, 02 Jun 2010 08:46:53 -0400, Steve Fábián <> wrote:

|| 2) How would you implement a loop that waits for the window to become
|visible before using ACTIVATE to rename it? The DELAY seems a brittle
|solution.
|
|For that very reason at my request Vince added the WAITWIN command to his
|sysutils.dll plugin. You can use that command instead. If you loaded the
|plugin, use its SYSHELP command for more details.

At some level TCC has to do nothing for a while. WAITWIN does this.

while ( (nReturn = WaitForMultipleObjects(3, EventHandles, FALSE, 20)) =WAIT_TIMEOUT )
{
Sleep(20);
tty_yield(0);
}

That probably isn't very different from

DO WHILE NOT ISWINDOW "title"
DELAY /M 20
REM timeout mechanism
ENDDO
--
- Vince
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Tray min'd TCMD and ACTIVATE Support 6
A v25 BC break in WINDOW and ACTIVATE Support 12
D activate /max fortnite Support 6
A Inconsistent @WINPOS // ACTIVATE /POS= behavior Support 0
Jay Sage Change in Behavior of Activate Command Support 4
Jay Sage Failure of ACTIVATE to Set a Window Position Support 3
vefatica WAD More on ACTIVATE Support 4
nickles activate "..." hide hides the foremost window Support 3
ehab aboudaya How to? activate tab with same directory in command line Support 6
dcantor Strange status in ACTIVATE command Support 0
Stefano Piccardi TCC ACTIVATE error Support 9
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
MickeyF Why doesn't my python program get executed without specifying its path? Support 2
gworley Virtual network drive filename completion doesn’t get directories Support 0
vefatica Win10's ANSI doesn't like 2>NUL Support 10
vefatica Win10, alternative screen buffer, cursor doesn't blink Support 11
M Trying to use ffind with a @file.lst doesn't work Support 4
Charles Dye Ctrl-Shift-Up doesn't update directory history Support 1
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30
vefatica Fixed JOBS /K doesn't work Support 2
E Fixed SHRALIAS doesn't work / SHRALIAS.EXE is missing in v20.11.35 Support 2
D WAD Reboot doesn't shutdown or restart Support 13
M Documentation Q.Search doesn't support selection? Support 1
R Fixed 7ZIP Compression Method Option Doesn't Work Support 1
T Regex engine doesn't recognize native DOS line endings Support 2
E Fixed DEDUPE doesn't handle filenames with whitespace properly when symlinking Support 1
D Docking doesn't persist Support 5
E WAD DESCRIBE under TCC 19 doesn't work with diacritics Support 14
C VIEW PRINT /Wrap doesn't work Support 0
D CD doesn't always find everything Support 8
M View doesn't recognize Ctrl+End and Ctrl+Pos1 Support 2
M Ctrl-End doesn't work. DelToEnd is not executed Support 13
B Fixed FFIND doesn't find last character in file without CR/LF at EOF Support 1
G .BTM association doesn't work anymore Support 1
jadaml Documentation Is COPY realy doesn't work for any HTTP and FTP? Support 3
D do /s doesn't recurse Support 1
D WAD Alt-Left doesn't work, but Alt-Shift-Left does Support 1
I How to? Bat Works but BTM Doesn't Support 6
B %@lines doesn't count last line without cr/lf at eof Support 1
williamleara WAD ribbon doesn't remember expand/collapse setting Support 3
vefatica Why doesn't "IDE %_ININAME" work? Support 4
M How to? /Elevated doesn't do it for me... Support 8
D Why doesn't ffind find directory? Support 3
Phileosophos TPIPE doesn't work at all with v16 Support 3
D ejectmedia doesn't work in v16 Support 2
Phileosophos Fixed Register for all users doesn't register for all users Support 10
T "Checking for a newer version" doesn't complete Support 18
vefatica Doesn't IDE auto-indent? Support 3
C FFind /w works but FFind /= doesn't? Support 2
noahcoad WAD cmd.exe under tcc doesn't find apps Support 4

Similar threads