TC on USB and the Buttonbar

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Unitec
Junior Member
Junior Member
Posts: 2
Joined: 2016-03-30, 12:04 UTC

TC on USB and the Buttonbar

Post by *Unitec »

First sorry for my bad English.

I have the TC running on an USB Device.

When i add an Programm ( on the same usb device ) to the Buttonbar the Link shows to Driveletter/Dir/Programm.
So the Button will only works with that Driveletter.
But each PC gives an other Driveletter.

Is ist possible the the Links were Dynamic to the Driveletter ?

At the moment i have to edit the Buttonbar Links by hand to %commanderpath% .

Could this be Automatet when the TC is Installed on an USB Device and started via starttc.exe

Thanks for your Time to read tis post.

Regards Unitec
User avatar
Hacker
Moderator
Moderator
Posts: 13065
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Hello Unitec,

Code: Select all

%COMMANDER_DRIVE%
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

PoSh:Buttonbar command automatically Commander_Path _Drive

Post by *Stefan2 »

Hi and welcome to the community.
Unitec wrote:Is ist possible the the Links were Dynamic to the Driveletter ?
That is an old question:
http://ghisler.ch/board/viewtopic.php?t=19515&highlight=button+commanderpath+automatically

:D and still no solution for this issue.

But the buttons are stored in a *.bar file in the TC folder, ("DEFAULT.BAR" on default)
which is a plain TEXT file and can be edited with an text editor: search&replace .... :wink:






Usually, I write a small script to
[face=timesnewroman]-- $CurrPath = GetEnvVar("%Commander_Path%") #get actual TC path
---- for each *.bar file
---- ---- for each line in BAR do
---- ---- $Line.replace $CurrPath by literal "%Commander_Path%" string[/face]
(pseudo code)




For example with PowerShell

In TC open PowerShell console. Be sure to be in *main* TC folder where the 'TOTALCMD.EXE' is

First, backup the *.bar's:
mkdir C:\Temp\TC-Bars; Dir -rec *.bar|ForEach{Copy $_ C:\Temp\TC-Bars\}

Now modify the *.bar's to use "%Commander_Drive%": by exchanging actual path with env var %xxx%
dir -fi *.bar |ForEach{$Cont=(GC $_).Replace(($env:Commander_Drive),"%Commander_Drive%");Out-File -enc ASCII -input $Cont -file $_}


Or, for all subfolders, use 'dir -recurse ':
dir -rec -fi *.bar | ........




To use "%Commander_PATH%":
dir -rec -fi *.bar |ForEach{$Cont=(GC $_).Replace(($env:Commander_Path),"%Commander_Path%");Out-File -enc ASCII -input $Cont -file $_}




.
Last edited by Stefan2 on 2016-03-31, 08:30 UTC, edited 2 times in total.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Currently TC converts paths to %COMMANDER_PATH% when you drag programs from TC folder to a buttonbar, but it doesn't convert paths to %COMMANDER_DRIVE%.
So if one wants automatic drive letter conversion, he may try moving programs to some subfolder of TC folder on USB stick to enable paths to %COMMANDER_PATH% conversion.
However it may be really more convenient just to run script sometimes to convert drive letters to %COMMANDER_DRIVE% in all buttonbar files on USB stick.
Unitec
Junior Member
Junior Member
Posts: 2
Joined: 2016-03-30, 12:04 UTC

Post by *Unitec »

Im Sorry that im bringing Up an Old Question.

Thanks for your Time and Help.
Post Reply