Launch TC with another different button bar?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Spiderkeys
Junior Member
Junior Member
Posts: 53
Joined: 2015-04-07, 10:02 UTC

Launch TC with another different button bar?

Post by *Spiderkeys »

Hello,

I have several button bars, depending on whatever project i'm doing, although it's good I can start TC with the correct directories from the command prompt, but isn't there anything is start with another button bar.

I just can't find a way to start the correct button bar, which would make everything perfect.

I know you can know permanently change it using the menu, but then I got the hassle of changing it back to the default again, after I'm finished, plus I rather have all directories and the correct button bar in front of me with just 1 click.

Any good shortcut suggestions, atm I got an icon linking to each button bar on the default menu which hassle to locate with so many icons all the time.

I did once create separate ini start-ups files for each project, but then in the long-term a painful mess keeping them all updated in sync with each other with settings I like to change globally.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Hi and welcome Spiderkeys.


If you launch TC from command line / batch anyway, you could perhaps use this work around:

- use a tool like TCMC to send a TC-command to TC.
(http://en.totalcmd.pl/download/add/Add/TC_Multiple_Commands)



- But TCMC can't execute the OPENBAR command
- so you have to create a user command in usercmd.ini first:
[em_OpenBarProjectABC]
cmd=OPENBAR %Commander_Path%\BARs\ProjectABC.bar




- next create you TC-Launch.cmd like
TC-ProjectABC.cmd

Code: Select all

@ECHO OFF

REM launch TC:
start "" %Commander_Path%\totalcmd.exe C:\Temp X:\ProjectABC

REM timeout to let TC start:
timeout /T 3

REM send a command to TC
%Commander_Path%\plugins\TCMC\tcmc.exe EMem_OpenBarProjectABC


Perhaps, if wanted, the same for Tabs and menu?
OPENTABS <filename>
OPENLANGUAGEFILE <filename.mnu>


Depends how often you have to change this settings/projects....
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

TCFS2 is able to execute OPENBAR command with any bar via a single proxy command em_OpenBar with command OPENBAR and parameter %A.

Code: Select all

TCFS2.exe /ef "tem(`em_OpenBar X:\My\Project.bar`)"
Perhaps it would be better to create menu with projects and load tabs and bars for every project using its menu item. It is also possible with TCFS2 using similar proxy command em_OpenTabs:

Code: Select all

TCFS2.exe /ef "tem(`em_OpenBar X:\My\Project.bar`) tem(`em_OpenTabs X:\My\Project.tabs`)"
Spiderkeys
Junior Member
Junior Member
Posts: 53
Joined: 2015-04-07, 10:02 UTC

Post by *Spiderkeys »

Thanks, I am looking into this, but unfortunately the code I enter just ignores me in the command prompt/batches.

I'm using the 64bit only version, that could be it.

I get it to work soon.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Spiderkeys,
Which one are you trying? All suggestions involve adding em-commands to TC (via cm_CommandBrowser or by manual editing usercmd.ini).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50923
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You could use environment variables the [Buttonbar] section, e.g.

[Buttonbar]
Buttonbar=C:\Wincmd\%barname%.BAR

Then start the TC via a batch file which sets the %barname% variable before launching TC.
Author of Total Commander
https://www.ghisler.com
Spiderkeys
Junior Member
Junior Member
Posts: 53
Joined: 2015-04-07, 10:02 UTC

Post by *Spiderkeys »

Hmm, I'm nearly there, I created a external command (em_), and it works by simply adding it in as a button, eg. em_OpenBarMyProject and cmd=OPENBAR %Commander_Path%\MyProject.bar but I just can't find a way for TCMC or TCFS2 to recognise it, I'm ok executing cm commands with TCMC because they contain numbers, but what was confusing was I do not have a usercmd.ini file anywhere, but found wcmd_en2.ini then added to that.

Now I got a command created, only need now to figure out how to execute em_OpenBarMyProject from a batch file.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Spiderkeys wrote: I do not have a usercmd.ini file anywhere,
Just create a plain text file named "usercmd.ini" in the TC folder.
Then use this.

- - -
Spiderkeys wrote:I just can't find a way for TCMC .... to recognise it, I'm ok executing cm commands with TCMC because they contain numbers,
For TCMC, Prefix the command by CM or EM respectively:
TCMC\Read.me wrote:Each parameter has to start with 2 letters that specify message type.
CM for internal commands (cm_SrcShort etc.) and EM for external ones (em_something).

Examples:
TCMC.exe [delay] params

TCMC 50 CM301 EMem_do_nothing CMcm_LeftPrevCustomView

 
Spiderkeys
Junior Member
Junior Member
Posts: 53
Joined: 2015-04-07, 10:02 UTC

Post by *Spiderkeys »

Ahh thanks a lot, a bit of more fiddling I worked out it, I tidied up and created a usercmd.ini and cut and pasted my code from out from the wcmd_en2.ini, I entered before (not that it seemed nesscessary, but I like it done the correct way)

I was testing commands like TCMC 50 em_OpenBarMyProject, with no luck until I found out from above I need two em's (TCMC 50 EMem_OpenBarMyProject) or two cms.

Now I wouldn't mind my project/button bars to each have their own wincmd.ini each, so my panels change with their own colors/fonts/icon sizes so I can identify them better even if this does cause a slight delay between switching.

My script I would think of right now would be (between switching)

@Echo off
taskkill /im totalcmd.exe
start /w "" totalcmd.exe /i=myproject1.ini /O /S /R=c:\Sources /L=d:\destinations
start "" "TCMC.exe" 50 EMem_OpenBarMyProject
exit

That could work more or less but probably could also try a TCMC command to also close all tabs on left and right or I'll be flooded with them.

Or better still if only you could have your buttonbar names displayed ontop of your buttonbars for easy identification..
Spiderkeys
Junior Member
Junior Member
Posts: 53
Joined: 2015-04-07, 10:02 UTC

Post by *Spiderkeys »

Just realised what I just said above, using seperate ini files wood defeat the purpose using TCMC, just a whole new ini file just to change the icons sizes a few colors would be very poor scripting, what I should try to do, is actually just write to the single ini file within a batch, but I think Im go to a batch forum for help there, but thanks a lot now I got so many new possibilities to make TC work exactly as I used to dream off!
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can write INI values with TCFS2 using set_tcini function.

I think you can reserve first buttonbar button for identification: just set some noticeable icon for it.

BTW why do you kill TC before starting new one? You can just pass commands to a running copy using /O parameter (which you already use but after killing TC so it does nothing in your case). And I don't understand the reason for /w parameter of start command: it should wait until TC closed so next command shouldn't work.
Spiderkeys
Junior Member
Junior Member
Posts: 53
Joined: 2015-04-07, 10:02 UTC

Post by *Spiderkeys »

What now i'm trying to achieve is that I normally use 32x32 Icons, but one buttonbar which is my NirSoft Utilities, is too cluttered with that size, so I need 16x16 Icons just for that buttonbar, without resorting to a TC Restart or a complete separate .ini file.

Image: http://s2.postimg.org/azqdk0twp/001.jpg

Image: http://s2.postimg.org/dfnlk4mll/002.jpg

There's only a single variable I need to change which is Buttonheight=37 to 21 under [Buttonbar] in wincmd.ini

I tried changing it from 37 to 21 in notepad then saving then typing TOTALCMD.EXE /O /I=WINCMD.INI from the command prompt, but didn't change except it just focused on the window.

Only a complete TC restart changed them to 16x16.

As soon as I can sort that out, I can start my switch batch file, but yeah I now trying messing around with TCFS2, but yeah that /w switch was pointless, I quickily noticed.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You need to re-show buttonbar in order to apply new size (TC rereads buttonbar configuration when it is shown).

You can use single TCFS2 call to change buttonbar size and then load another buttonbar file:
TCFS2.exe /ei tb0 /ef "set_tcini(Buttonbar,Buttonheight,21)" /ei tb1 /ef "tem(`em_OpenBar D:\TOTALCMD\Bars\Work.bar`)"
(keep in mind that mentioned em_OpenBar should be pre-created in TC).
Post Reply