1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

TCC ACTIVATE error

Discussion in 'Support' started by Stefano Piccardi, Oct 8, 2008.

  1. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    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.
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  3. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    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 wanted TITLE because I'm reserving TITLEPROMPT for by 4START.btm file.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,938
    Likes Received:
    30
    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
     
  6. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    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.
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    Stefano Piccardi 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.)

    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
     
  8. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    No, I want to raise TCC to the top after something else - symbolized by ... in the script -- happens. I don't want topmost.
    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.
     
  9. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  10. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    Steve Fábián wrote:

    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
     

Share This Page