Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

TCC ACTIVATE error

TCC 9.02.152 Windows XP [Version 5.1.2600]
batch file fragment
Code:
@echo off
setlocal
set title=A Title177
title %title%
on errormsg pause
...
ACTIVATE "%title%*"
...
do forever
  on break leave
  ACTIVATE "%title%*"
  on break
enddo
I consistently get errors from this batch file. The first ACTIVATE command prints an ERROR message, The operation completed successfully "A Title177*"
The second ACTIVATE prints and error message, The system could not find... "A Title177*"
If I run the complete batch file on another PC I get the same error messages, but not as consistently.
If I replace ACTIVATE with CMDOW - an external utility that activates windows based on their title - I get no errors and windows are activated as expected.
 
Stefano Piccardi wrote:
| TCC 9.02.152 Windows XP [Version 5.1.2600]
| batch file fragment
| Code:
| ---------
| @echo off
| setlocal
| set title=A Title177
| title %title%
| on errormsg pause
| ...
| ACTIVATE "%title%*"
| ...
| do forever
| on break leave
| ACTIVATE "%title%*"
| on break
| enddo
| ---------
| I consistently get errors from this batch file. The first ACTIVATE
| command prints an ERROR message, The operation completed successfully
| "A Title177*"
| The second ACTIVATE prints and error message, The system could not
| find... "A Title177*"
| If I run the complete batch file on another PC I get the same error
| messages, but not as consistently.
| If I replace ACTIVATE with CMDOW - an external utility that activates
| windows based on their title - I get no errors and windows are
| activated as expected.
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

If I read the code correctly, the ACTIVATE commands attempt to activate the
same window in which the batch file is running, but that window must already
be active for the ACTIVATE command to be executed. From help topic
"activate.htm":

ACTIVATE activates, and optionally modifies, another session's window. It is
not intended to modify the characteristics of the current TCC session (use
TITLE or WINDOW for that purpose).



BTW, using the TITLEPROMPT variable instead of calling it TITLE would allow
deleting the TITLE command...

--

HTH, Steve
 
From help topic "activate.htm":

ACTIVATE activates, and optionally modifies, another session's window. It is
not intended to modify the characteristics of the current TCC session (use
TITLE or WINDOW for that purpose).
Thanks Steve, it helps. I had interpreted that section differently when I read it. Unfortunately, unless I'm misreading the help file again, WINDOW can RESTORE the current window but it can't activate it or put it on TOP, so I'm forced to use CMDOW or DETACH /Q ACTIVATE, which both start a new process. Oh well...
BTW, using the TITLEPROMPT variable instead of calling it TITLE would allow
deleting the TITLE command...
I wanted TITLE because I'm reserving TITLEPROMPT for by 4START.btm file.
 
Stefano Piccardi wrote:
| ---Quote (Originally by Steve Fábián)---
| From help topic "activate.htm":
|
| ACTIVATE activates, and optionally modifies, another session's
| window. It is
| not intended to modify the characteristics of the current TCC session
| (use
| TITLE or WINDOW for that purpose).
| ---End Quote---
| Thanks Steve, it helps. I had interpreted that section differently
| when I read it. Unfortunately, unless I'm misreading the help file
| again, WINDOW can RESTORE the current window but it can't activate it
| or put it on TOP, so I'm forced to use CMDOW or DETACH /Q ACTIVATE,
| which both start a new process. Oh well...

I have not tried, but doesn't WINDOW RESTORE put the window on top as part
of "restore"? If not, we need a new subcommand for the WINDOW command to do
that...
--
Steve
 
I have not tried, but doesn't WINDOW RESTORE put the window on top as part
of "restore"? If not, we need a new subcommand for the WINDOW command to do
that...
--
Steve

It does here, even if the window wasn't on top when it was, say, minimized. Try it; after the first DELAY, put some other window on top.

delay 5 & window min & delay 3 & window restore
 
It doesn't if the window isn't minimized first. Try
delay 3 & window restore​
During the delay cover the window with another window, nothing changes afterwards here.
 
Stefano Piccardi wrote:

> TCC 9.02.152 Windows XP [Version 5.1.2600]
> batch file fragment
> Code:
>
> @echo off
> setlocal
> set title=A Title177
> title %title%
> on errormsg pause
> ...
> ACTIVATE "%title%*"
> ...
> do forever
> on break leave
> ACTIVATE "%title%*"
> on break
> enddo
>
> I consistently get errors from this batch file. The first ACTIVATE
> command prints an ERROR message, The operation completed successfully "A
> Title177*"
> The second ACTIVATE prints and error message, The system could not
> find... "A Title177*"
> If I run the complete batch file on another PC I get the same error
> messages, but not as consistently.
> If I replace ACTIVATE with CMDOW - an external utility that activates
> windows based on their title - I get no errors and windows are activated
> as expected.

I don't know what you're trying to do here -- always force TCC to the
top? (It'd be a lot easier to use WINDOW TOPMOST.)

I don't have any problems with this batch file unless I cover the TCC
window with another app's window, at which point Windows (as expected --
this is a Windows feature!) will refuse to let TCC put itself back on
top. Is that what you're attempting to do?

Rex Conn
JP Software
 
I don't know what you're trying to do here -- always force TCC to the
top? (It'd be a lot easier to use WINDOW TOPMOST.)
No, I want to raise TCC to the top after something else - symbolized by ... in the script -- happens. I don't want topmost.
I don't have any problems with this batch file unless I cover the TCC
window with another app's window, at which point Windows (as expected --
this is a Windows feature!) will refuse to let TCC put itself back on
top. Is that what you're attempting to do?
Yes.
I found that if I use DETACH /Q ACTIVATE "%title%" I get exactly what I want, Windows lets me raise the window on top without making it topmost. At the cost of an extra process, but that's OK.
 
rconn wrote:
...
| I don't know what you're trying to do here -- always force TCC to the
| top? (It'd be a lot easier to use WINDOW TOPMOST.)

According to the 9.02.152 help topic "window.htm", TOPMOST is only valid in
a tab window. OP wants a TCC window to be moved to the top (but not
permanently, as TOPMOST is described) when the batch file execution arrives
to the specific command.
--
Steve
 
Steve Fábián wrote:

> rconn wrote:
> ...
> | I don't know what you're trying to do here -- always force TCC to the
> | top? (It'd be a lot easier to use WINDOW TOPMOST.)
>
> According to the 9.02.152 help topic "window.htm", TOPMOST is only valid in
> a tab window. OP wants a TCC window to be moved to the top (but not
> permanently, as TOPMOST is described) when the batch file execution arrives
> to the specific command.

Windows only allows that in limited cases. The SetForegroundWindow API
documentation has details on what will work and what won't.

Rex Conn
JP Software
 

Similar threads

Back
Top