How-to "Create New File" in TC? . (new text file)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
wppr
Junior Member
Junior Member
Posts: 11
Joined: 2008-03-23, 20:25 UTC

How-to "Create New File" in TC? . (new text file)

Post by *wppr »

Hi all.

I'm looking for a way to create a new file using a keyboard shortcut.
I couldn't find this feature on TC alone, so i looked for a plug, but no luck.

To be more precise -
I want to set (ie.) ctrl+shift+T to create an new .txt in the selected dir.
Or at least to open the 'new file' dialog...

I thought this was the place to ask... :)
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

Welcome wppr

Maybe <Shift+F4> "Create new text file and load into editor" is what you are looking for?

HTH,
Holger
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

http://en.totalcmd.pl/download/add/Add/New_File
http://en.totalcmd.pl/download/add/add/Newfile
http://www.qunomsoft.com/nf_index.htm
http://tcup.pl/index.php?l=en&s=download&akcja=pokaz (this is a big download that has another alternative inside)

Search this forum for more suggestions (like instantly creating one)

Edited.
wppr
Junior Member
Junior Member
Posts: 11
Joined: 2008-03-23, 20:25 UTC

LOL

Post by *wppr »

Hahahaha....
I didn't expect an answer this fast...

Thank you soooo much for saving me the time. :)
wppr
Junior Member
Junior Member
Posts: 11
Joined: 2008-03-23, 20:25 UTC

ahhh....

Post by *wppr »

Ok... I got somewhere.

Using Stefan2's advice, i made the "usercmd.ini" with the command

Code: Select all

[em_NewFile]
Cmd=notepad
Param=?&P%O
But! :)
But, Notepad asks me if i want to create the new file, as it does not exist...
I find this rather annoying, because - of course i want to create it, damn it! :)

So, i'm thinking... There's got to be a command for notepad to save the file automaticaly...

Ideas?

I can live with pressing 'enter' every time, it's just... It aint perfect that way... :)

-----------------------------

I also must say, that this specific topic should be in the FAQ or wiki or something, where it is very visible,
as i've this question quite a few times while boaring through the forum... It might save some time to all.

-----------------------------

I'm going to bed, the whole searching thing has me brainwashed.
I hope not to dream the SHIFT+F4 monster... :)
Good night ppl...
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

Yes, there is a solution.
It's quick and dirty, I wrote it some time ago for sb. asking the same question on the polish forum.
Usage:
Download putfile.exe to some directory. In this directory create a file named "editor". Yes, without extension. Write

Code: Select all

notepad
inside. (In general - path to editor you want to use with putfile).
Change your command to

Code: Select all

[em_NewFile]
Cmd=c:\path_to_putfile\putfile.exe
Param=?&P%O 
wppr
Junior Member
Junior Member
Posts: 11
Joined: 2008-03-23, 20:25 UTC

Post by *wppr »

So i did exactly that.
This is the comand in usercmd.ini

Code: Select all

[em_NewFile]
Cmd=D:\blabla...\plugins\Putfile\putfile.exe
Param=?&P%O
button=
And in the same folder, a file named editor with this in it:

Code: Select all

C:\WINDOWS\notepad.exe
The command opens up the dialogue asking for name of the file. [the dialogue gives the name of the selected item + &P before it!]
I write 'asd'.
And it creates just a file named asd. No extension. No nothing.

I'd say there's a mistake in the command line. Or i did something all wrong.

-----------------------------

One more thing:
Is there a quick way to copy the location of current dir, without using the command line?
I always have to click the bar which shows this (just above the file list) twice, and then copy...
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

You did it correctly, but I forgot that you want .txt appended automatically. ;)
The solution is getting dirty, but you can fix it with additional .bat file.

Code: Select all

D:\blabla...\plugins\Putfile\putfile.exe.exe %1.txt
Call this .bat instead of putfile.

2 notes:
I recommend using %COMMANDER_PATH%, this way you can move TC dir somewhere else and this will keep working.
Even though I said that you should use "path to editor" in "editor" file, notepad is one of a few programs for which name is enough.
User avatar
Stefan2
Power Member
Power Member
Posts: 4157
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

wppr wrote: [the dialogue gives the name of the selected item + &P before it!]
Correct Param is %P
instead of &P


Param=?%P%O

? means: show the dialog so the user can see whats happend and modify if he wants
%P means: path of the selected file
%O means: file name-part of the selected file (without the extension)
%N means: whole file name of the selected file

Press F1 while in button setup dialog for more.

I write 'asd'.
And it creates just a file named asd. No extension. No nothing.

I'd say there's a mistake in the command line. Or i did something all wrong.
NO, that's fine. You have to add f.ex. ".txt" your own. So you are flexible.

OR... you could use f.ex.:
%P%O.txT

And while hover f.ex. over "TOTALCMD.EXE" you would get an new file "TOTALCMD.txT"
(Great f.ex. to create description text files for downloaded EXEs or archives)

If you add this '?' again as first char to "?%P%O.txt"
you see the dialog again and have the change to modify the name of the new file.


--------

For the fine putfile you can use:

Code: Select all

[em_NewFilePUTFILE] ; file 'editor' with path  to editor
cmd=%commander_path%\Plugins\NewFilePutFile\putfile.exe
Param=?%O
button=
You can modify this '?' and '%O' as you like. See help.


Or use the build-in feature "Shift+F4" to create a new file and open it with an editor.
The editor could be set in the TC-preferences "Viewer/Editor"
If you press "Shift+F4" while over an other file, the this name is suggested in the dialog-box.

-----------------------------
One more thing:
Is there a quick way to copy the location of current dir, without using the command line?
I always have to click the bar which shows this (just above the file list) twice, and then copy...
Don't fear to open an new threat for each single question. (First search the forum with different keywords)


Look in the "TOTALCMD.INC" file for all commands.
Search for "cm_CopyToClipboard" and another.

With this commands you can create buttons, or assign an short cut, or add it to the menu like:

Code: Select all

MENUITEM "...&Dateinamen", cm_CopyNamesToClip
MENUITEM "...Dateinamen mit &Pfad", cm_CopyFullNamesToClip
MENUITEM "...Dateinamen mit &UNC-Pfad", cm_CopyNetNamesToClip
wppr
Junior Member
Junior Member
Posts: 11
Joined: 2008-03-23, 20:25 UTC

Post by *wppr »

Thank you Stefan2, this was exactly what i wanted.

m^2, must say i don't understand the bat command you gave me.
But i did as you said. I made a .bat next to putfile.exe with the

Code: Select all

D:\blabla...\plugins\Putfile\putfile.exe.exe %1.txt
and made a new TC command, like this

Code: Select all

[em_NewTxt]
Cmd=%COMMANDER_PATH%\plugins\Putfile\putfile.bat
Param=?%O.txt
I've tried all changing and removing the parameters and editing the .bat - no luck.

And I won't be trying any more. This is already overly complicated, and i've wasted enough of our time.
It was fun :), but no more... Not everything has to be perfect.

I'll be using your putfile.exe and Shift+F4, depending on the needs.

I cannot thank you enough. :)
Bye.
Post Reply