Relative path column in branch view

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Calvin
Junior Member
Junior Member
Posts: 49
Joined: 2005-07-01, 08:09 UTC

Relative path column in branch view

Post by *Calvin »

The branch view is quite great to find the most recently updated files in a large tree. I use it quite often.

What i would like to have is a custom column view that shows me the relative path of the files. I can show the path, but i can't seem to find the relative path in any plugin. (it already shows in the taskbar for one file, so it should be possible...)

Any ideas?
TIA!
Calvin

-----------------
Disclaimer: Any errors in spelling, tact, or fact are transmission errors.
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

try Script Content plugin
-------
'fullpath.vbs
content=filename
--------
script.ini
[Script]
Section=fullpath

[fullpath]
Script=fullpath.vbs
LongName=1
User avatar
van Dusen
Power Member
Power Member
Posts: 684
Joined: 2004-09-16, 19:30 UTC
Location: Sinzig (Rhein), Germany

Post by *van Dusen »

Don't know why the forum don't like my posting, but if I try to send it, I get only the short message
"Please visit our site www.ghisler.com!" :? .
So I have UUE-encoded it :roll: ... Sorry for the inconvenience:

Code: Select all

begin 644 RelPath_Posting.txt
M3&5V)W,@<V-R:7!T(&=I=F5S('1H92!A8G-O;'5T92!F:6QE<&%T:"!A<R!R
M97-U;'0N($DG86T@869R86ED+"!T:&%T(&ET(&ES('-O;65W:&%T(&-O;7!L
M:6-A=&4@=&\@9V5T('1H92!R96QA=&EV92!P871H(&EN(&$@8W5S=&]M(&-O
M;'5M;B!I;B!B<F%N8V@@=FEE=RX@2&5R92!I<R!O;F4@<V]L=71I;VXN+BX@
M:70@=V]R:W,L(&)U="!I="!I<R!F87(@9G)O;2!B96EN9R!N:69T>3H-"@T*
M6V)=4')E8V]N9&ET:6]N<ULO8ET-"@T*6V)=,&$N6R]B72!(879E('1H92!4
M0W-C<FEP="!A9&1O;B!I;G-T86QL960N#0H-"EMB73!B+ELO8ET@2&%V92!T
M:&4@4V-R:7!T5T18('!L=6=I;B!I;G-T86QL960N#0H-"@T*6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YA=&EO;ELO8ET-"@T*5&AE(&)U
M='1O;B!C86QL<R!T:&4@1$]3(&)A=&-H(#Q296Q0871H+F)A=#XN(%1H:7,@
M8F%T8V@@=W)I=&5S('1H92!N86UE(&]F('1H92!C=7)R96YT('!A=&@@*"50
M*2!T;R!T:&4@9FEL92`\4F5L4&%T:%)O;W0N='AT/B!A;F0@8V%L;',@=&AE
M(%1#<V-R:7!T('-C<FEP="`\4F5L4&%T:"YT8W,^+@T*#0H\4F5L4&%T:"YT
M8W,^('-E=',@=&AE('9I97<@=&\@>6]U<B!P<F5F97)E9"!C=7-T;VT@8V]L
M=6UN('9I97<@86YD('-W:71C:&5S('1O(&)R86YC:"!V:65W+@T*#0H\4F5L
M4&%T:"YV8G,^(&ES="!A=71O;6%T:6-A;&QY(&-A;&QE9"!F;W(@96%C:"!E
M;G1R>2!I;B!T:&4@8G)A;F-H('9I97<N#0I)="!G971S('1H92!F=6QL(&9I
M;&5P871H("A[1')I=F4Z7%)O;W10871H7%!A=&A<1FEL92Y%>'1]+"!A=F%I
M;&%B;&4@:6X@(F9I;&5N86UE(BDL#0IC=71S(&]F9B!T:&4@9FEL96YA;64@
M*'M&:6QE+D5X='TL(&1O;F4@=VET:"!F:7)S="!L:6YE(&EN(#Q296Q0871H
M+G9B<SX@8F5G:6YN:6YG('=I=&@@(G)E;'!A=&@@/2`N+BXB*2P-"F-U=',@
M;V9F('1H92`B<F]O="(@<&%T:"`H>T1R:79E.EQ2;V]T4&%T:%Q]+"!D;VYE
M('=I=&@@<V5C;VYD(&QI;F4@8F5G:6YN:6YG('=I=&@@(G)E;'!A=&@@/2`N
M+BXB*2!A;F0-"G)E='5R;G,@=&AE(')E;&%T:79E('!A=&@@>U!A=&A<?2!T
6;R!T:&4@8W5S=&]M(&-O;'5M;BX-"@``
`
end
sum -r/size 62069/2632
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

van Dusen wrote:Don't know why the forum don't like my posting, but if I try to send it, I get only the short message
"Please visit our site www.ghisler.com!" :? .
You did use the very nasty string "Root dot txt", so I took the freedom to change the extension .txt to .lst what should work the same way (Please correct me if I'm wrong) and quoted your post here for better readability of this thread:
Lev's script gives the absolute filepath as result. I'am afraid, that it is somewhat complicate to get the relative path in a custom column in branch view. Here is one solution... it works, but it is far from being nifty:

Preconditions

0a. Have the TCscript addon installed.

0b. Have the ScriptWDX plugin installed.


Installation

1. Save this batch for DOS to <RelPath.bat>:

Code: Select all

@Echo OFF
Echo %1>C:\tmp\RelPathRoot.lst
C:\Programme\TotalCmd\Tools\TCScript\TCScript.exe /run C:\Programme\TotalCmd\Tools\TCScript\Scripts\RelPath.tcs
Probably you must change the paths to <TCscript.exe> and to your <Scripts\> directory.

2. Save this script for TCscript to <RelPath.tcs>:

Code: Select all

// PostCmd(cm_SrcCustomViewN) doesn't work for N>9
// cm_SrcCustomView9=282; Source: Custom columns 12

PostCmd(282);
PostCmd(cm_DirBranch);
Probably you must change the number of the command. (According to the number of the custom column set, which you like to use in branch view and which will contain a column for the ScriptWDX result.)

3. Save this script for ScriptWDX to <RelPath.vbs>:

Code: Select all

Dim fso, f

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("C:\tmp\RelPathRoot.lst")

relpath = left(filename, len(filename) - len(fso.GetFileName(filename)))
relpath = Mid(relpath, f.size - 1)
content = relpath

Set fso=nothing
Set f=nothing
4. Create a button in your button bar:

Code: Select all

Command: C:\Programme\TotalCmd\Plugins\ScriptWDX\RelPath.bat
Parameter: %P
Probably you must change the path to <RelPath.bat>.

5. Add a column with content "[=script.result]" to the custom column set, which you like to use for branch view (and wich you have refered in <RelPath.tcs> (step 2.)).


Usage

Click the button, which you have created in step 4.


Explanation

The button calls the DOS batch <RelPath.bat>. This batch writes the name of the current path (%P) to the file <RelPathRoot.lst> and calls the TCscript script <RelPath.tcs>.

<RelPath.tcs> sets the view to your prefered custom column view and switches to branch view.

<RelPath.vbs> ist automatically called for each entry in the branch view.
It gets the full filepath ({Drive:\RootPath\Path\File.Ext}, available in "filename"),
cuts off the filename ({File.Ext}, done with first line in <RelPath.vbs> beginning with "relpath = ..."),
cuts off the "root" path ({Drive:\RootPath\}, done with second line beginning with "relpath = ...") and
returns the relative path {Path\} to the custom column.
Hope that someone soon will teach that security robot. ;) :twisted:

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
van Dusen
Power Member
Power Member
Posts: 684
Joined: 2004-09-16, 19:30 UTC
Location: Sinzig (Rhein), Germany

Post by *van Dusen »

Ich bin in einer finst'ren Sekte,
die in mir die Erkenntnis weckte,
dass unsre kurze Daseinsfrist
mehr Spaß macht, wenn man böse ist...

:mrgreen:

I didn't know about this potential security hole, which could be exploited by using "nasty words" :(

Sheepdog, thank you very much for cleaning up my posting and your assistance! :)
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

van Dusen wrote:I didn't know about this potential security hole, which could be exploited by using "nasty words" :(
It seems there is a robot who tries to find hacking scripts by their usage of 'nasty words'. So once you could prevent your posting from being saved by using "ftp=". If you know about it you can deal with it. But it's really annoying.

Sheepdog, thank you very much for cleaning up my posting and your assistance! :)
You're welcome.

sheepdog

BTW nice lyrics.
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Calvin
Junior Member
Junior Member
Posts: 49
Joined: 2005-07-01, 08:09 UTC

Post by *Calvin »

Thanx guys, i'll give it a try.
Does sound like a nice [Req] for 6.0 :)
Calvin

-----------------
Disclaimer: Any errors in spelling, tact, or fact are transmission errors.
User avatar
majkinetor
Senior Member
Senior Member
Posts: 369
Joined: 2005-11-20, 10:36 UTC
Location: Belgrade, Serbia
Contact:

Post by *majkinetor »

van Dusen , you are really a freek with that encoded post :)
A good freek :)

Thx for the scripting example
We are not doing this just for the money.
We are doing it for sh*t load of money.
 
 
r-moth.com
r-moth.deviantart.com
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

Now I understood what is a relative path :)
Here is one more variant of a script for Script content plugin, it uses the Script Helper beta10 for it's work.

Code: Select all

'relpath.vbs
Dim fso, f, tcs

Set fso = CreateObject("Scripting.FileSystemObject")
Set tcs = CreateObject("TCScript.Helper")

f = tcs.GetSrcPath
relpath = left(filename, len(filename) - len(fso.GetFileName(filename)))
relpath = Mid(relpath, Len(f)+1)
content = relpath

Set fso=nothing
Set tcs=nothing
Post Reply