[SOLVED] 2Qs regarding (a) Button Bars and (b) File Creation

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
OldFritz
Junior Member
Junior Member
Posts: 2
Joined: 2016-08-13, 13:08 UTC

[SOLVED] 2Qs regarding (a) Button Bars and (b) File Creation

Post by *OldFritz »

Hello!

I am a little insecure on how to post my two questions at all, I tried the search but was pretty much overwhelmed by finding a lot of non-related posts. Please bear with me (TC 8.52a on Win7).

(1) Creating custom entries in the button bar, how can I use a user path variable for [USERNAME], allowing me to use one setup which can be freely copied between all my computers (each with a different user/account name)? E.g. something like this:

Code: Select all

cd "c:\Users\[USERNAME]\Temporary\"
... or should I approach this differently?

(2) I would like to be able to mark one file and per button create a new, empty ".txt" file with the same filename in the same pane., e.g. marking and pressing a button on:

Code: Select all

objekttraeger.avi
would (in the same pane) result in:

Code: Select all

objekttraeger.avi
objekttraeger.txt
... is this possible and if so, how would I have to do that?

I'm not so fit as I used to be and will have probably missed older entries dealing with such matters; thanks in advance!
Last edited by OldFritz on 2016-08-13, 15:42 UTC, edited 1 time in total.
User avatar
Dalai
Power Member
Power Member
Posts: 10033
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2OldFritz
Ad 1) Use something like

Code: Select all

cd "%UserProfile%\Temporary\"
Ad 2) You can either use Shift+F4 on the existing file and replace the extension (creates the new file and opens it in the default text editor), or you can use a button like this:

Code: Select all

TOTALCMD#BAR#DATA
CMD.exe /C
"copy NUL "%P%O.txt""
shell32.dll,-152
Create a new text file from the file name under cursor

1
-1
But be careful! This button replaces existing files without any confirmation! Copy the code above and paste it onto some free space of the button bar to create a new button; you may adapt it to your needs.

Regards
Dalai
Last edited by Dalai on 2016-08-13, 15:51 UTC, edited 1 time in total.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
OldFritz
Junior Member
Junior Member
Posts: 2
Joined: 2016-08-13, 13:08 UTC

Post by *OldFritz »

@Dalai,

THANKS!!!

Exactly what I needed. The warning re: overwriting existing files is a good point and may be vital for others, in my case that is to be neglected (even *if*, there is no vital data loss).

Again, thanks for your quick answer!
jvh
Member
Member
Posts: 187
Joined: 2007-07-20, 12:28 UTC

Post by *jvh »

Hi,

just for safety...
This command preserves existing file:

Code: Select all

TOTALCMD#BAR#DATA
CMD.exe /C
"IF NOT EXIST "%P%O.txt" (copy /b nul "%P%O.txt") ELSE EXIT"
shell32.dll,-152
Create a new text file from the file name under cursor

1
-1
This one opens file in Notepad if already exists:

Code: Select all

TOTALCMD#BAR#DATA
CMD.exe /C
"IF NOT EXIST "%P%O.txt" (copy /b nul "%P%O.txt") ELSE (start notepad.exe "%P%O.txt")"
shell32.dll,-152
Create a new text file from the file name under cursor

1
-1
Post Reply