Welcome!

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

SignUp Now!

How to? Activate the TCMD Help Window

Jun
762
16
I have a script called POSITION that activates specified windows and sets them to specified positions and sizes. However, I cannot figure out how to get the ACTIVATE command to access the help window, even using the =PID reference to the task. Does anyone know how to do this?

Part of the reason for this is that for a few weeks, when Windows goes to sleep, either from its own power settings or by using reboot /w, all of my apps get moved to the upper-right corner of the screen. Has anyone else seen this or know what to do about it?
 
That doesn't work for me, probably because I am using TakeCommand, not TCC standalone. That is the command that I use to activate and place the TakeCommand window.

Hmmm, I just detached all my TCC sessions in Take Command, which then closed. Your command still doesn't work. Ahh, but if I close all JPSoft tasks and them open a TCC standalone window, it does work.

So I have to update my question: How do I do it from a TCC tab in TCMD?
 
Actually, it is even more complicated. I was trying to activate it from its minimized state, which does not work -- unless I minimize it using the ACTIVATE command rather than the button at the upper-right. If I include some positioning option, it does come back, but otherwise it sits in the taskbar. Ugh.
 
Same here, so do activate "Take*33" restore first. You can see if that's needed with (2 = minimized)

Code:
d:\tc33> echo %@winstate[take*help*33]
2

And you can always minimize it again.
 
This worked after I minimized it with the [_] button.

Code:
activate "Take*33" restore & activate "Take*33" center & activate "Take*33" min
 
I think you (actually, Rex) can get and set the restored position of a minimized window with GetWindowPlacement and SetWindowPlacement. The docs seem to imply this but I haven't tried it.
 
Thanks. With your help, I am making progress. Now I'm trying to figure out how to determine whether the help is active at all. When I use the WINSTATE function and HELP is not active, I get a syntax error message, one that cannot be hidden by redirection.

echo %@winstate["take*help*WRONG"] >nul
TCC: (Sys) The parameter is incorrect.
"%@winstate["take*help*WRONG"]"

echo %@winstate["take*help*WRONG"] >& nul
TCC: (Sys) The parameter is incorrect.
"%@winstate["take*help*WRONG"]"

echo %@winstate["take*help*WRONG"] >&> nul
TCC: (Sys) The parameter is incorrect.
"%@winstate["take*help*WRONG"]"

Moreover, that is a strange error message. There is nothing wrong with the parameter per se; there simply is no matching window title. I would expect a "Window not found" message. In fact, the function really should return a code (e.g., -1) with that information.

Vince, can you come up with a way to see if the help is running? I don't like to have garbage error messages pop up with my scripts.
 
Ah, I can use ACTIVATE "title" restore >& tmp0: and then check to see if tmp0: is empty or has a line. The ACTIVATE command properly writes its error message to standard error.
 
Last edited:
I just played around with some other functions, and it seems that their error messages can never be hidden by redirection.

echo %@bread[a] >&> nul
TCC: (Sys) The parameter is incorrect.
"%@bread[a]"

That seems odd to me, but Rex usually has a good reason for things that seem odd to me :smile:
 
Code:
if %@pid[eviewer.exe] != 0 echo The help is running.

There are probably other ways.

I don't know exactly why, but ... (maybe because the error comes from @BREAD and not from ECHO?)

1733956256711.webp
 
Code:
if %@pid[eviewer.exe] != 0 echo The help is running.

There are probably other ways.

I don't know exactly why, but ... (maybe because the error comes from @BREAD and not from ECHO?)

View attachment 4744

TCC does variable expansion before redirection. Otherwise you wouldn't be able to, say, redirect to a filename specified in a variable. The parentheses force TCC to do the redirection before evaluating the command's args.
 
Thanks everyone. I have to say that one of the great things about TCC is that after all these decades of using it (since 4dos), one can still have so much fun learning new things.

I had also come to the conclusion that the function error messages could not be redirected the way they are from commands. And, Vince, I should have thought of using @pid -- since it was already in my code! Some of the problems I was having earlier must have been the result of a typo in the code. Everything seems to be working now.
 
No one has commented about my observation that when my computer goes to sleep, all the windows often end up stacked on top of each other in the upper-left corner of the screen. My position.btm script supports the option ALL to reposition all the windows back to where I want them and then minimized, except for TCMD.

I'm not aware that I made any change to the system (though perhaps I did without realizing it). I figured it was the result of a Windows update.
 
Google it! "After sleep windows stacked upper left" turned up several promising hits.
 
Back
Top