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

SignUp Now!

Testing for Presence of Toolbar

Can anyone suggest a way to test whether a TCMD toolbar is present, i.e., if there is at least one button? I have a script in which I want to reload my standard toolbar only if no toolbar is already present. I have not been able to find a system variable for that (_tctabactive does not do it).
If I clear the toolbar with;
tctoolbar /c
...and then write the empty toolbar to a file, the file has a size of 0 bytes.

Thus, there are no buttons on the toolbar.

If I reset the toolbar to the definition in TCMD.INI;
tctoolbar /i
...and then write the toolbar to a file, the file has a size of 3,550 (YMMV).

if %@filesize[e:\utils\stuff.txt] eq 0 echo No Toolbar with buttons

Writing the toolbar to a file is as follows;
tctoolbar /w e:\utils\stuff.txt

Thanks. I think I can use that approach (though a system variable might have been nicer). One problem I ran into is that, at least with v25, the command "tctoolbar /w junk.txt" does not write to the file. I have to include a fully qualified path ("tctoolbar /w %@full[junk.txt]". That's weird. Actually, even that isn't always working. I'll have to check this out in version 27.
I also ran into another problem because my new computer is so fast. After writing out the toolbar file, I have to add a delay before checking the size. If I don't, either the size registers as zero or the file does not even get written (not sure which, but my testing fails).
I finally gave up on this approach. The TCTOOLBAR command with the /W option does not work correctly. In both versions 25 and 27, when I specify a simple file name (tctoolbar /w temp.txt), no file is written out, even when I have a very complex toolbar with multiple tabs and buttons clearly visible. If I use a file name with a path (tctoolbar /w c:\temp.txt), a file is created. But now I discovered that it does not necessarily contain the data for the currently visible toolbar. When I started up TCMD, no toolbar appeared. I then issued the command, and a file was written with what looked like the content of the toolbar I wanted to have but which was not visible.

My new approach is to test for the first TCC tab in TCMD. In that case, I clear and reload the toolbar from my configuration file. After that, new TCC tabs leave the toolbar alone, so it stays in the tab I have selected instead of reverting to the first tab.

Rex, can you explain what is going on with the /W option?

Similar threads