How to? New file without extension

I use the following button

<?xml version="1.0"?>
<button backcol="none" display="both" hotkey="ctrl+shift+N" label_pos="right" textcol="none">
	<label>...File</label>
	<tip>Create a new (empty) file</tip>
	<icon1>#newmenu</icon1>
	<function type="batch">
		<instruction>FileType NEW=.txt NEWNAME=&quot;new_file&quot; </instruction>
	</function>
</button>

for creating a new file and renaming inline, which I find insanely useful, but this creates a new .txt file. Is there anyway I can get it to create a new file without an extension? Or to have the inline rename select the extension as well?

In inline mode, you can use ctrl+E to select extension...

Or F2 just after click on your button...

or maybe you can combien button from this post [New... textfile > How to auto-select it?)

and add "rename inline=ext" at the end to select extension.

But i think rename inline=ext don't work anymore, rename dialog open :blush:

Rename inline home and name work but all/end/ext not :cry:

Try this button:

FileType NEW=.txt NEWNAME="new_file.{dlgstringS|Enter extension|txt}"

It let's you first specify the extension of the new file (or press enter to create a new .txt file).

Edit: Ignore the first two paragraphs. I found a way to do it.

[s]You could create an empty file somewhere and make a button which asks for a filename and copies that empty file to the given name.

(Or think of a DOS command that can create an empty file and used that to make the empty file. I can't think of a good command, though. even echo.>test produces a non-empty file called test with a return in it.)[/s]

I'm curious, why do you want to create empty files without extensions in the first place? Seems unusual. Or do you want extensions on the filenames, you just don't want to be tied to any particular one?

Here we go (I think):

@set name={dlgstringS|Enter File Name|Readme.txt} copy FILE="nul" AS="{$name}" HERE select {$name}

Here it is as a full button (see the FAQ on what to do with the XML):

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Create empty file</label> <icon1>#default:rename4</icon1> <function type="normal"> <instruction>@set name={dlgstringS|Enter File Name|Readme.txt}</instruction> <instruction>copy FILE=&quot;nul&quot; AS=&quot;{$name}&quot; HERE</instruction> <instruction>select {$name}</instruction> </function> </button>

Thanks for your help guys - the reason I wanted a new file without an extension is because I create new files ALL the time, and there's no telling what the file's going to be - sometimes it's a Word document, sometimes a txt file, sometimes HTML or PHP or CSS. Rather than choosing from a drop-down-list of new files to choose from (which you get from the DOpus context menu) I find it much easier to simply create a new empty file, and then just whack .doc or .html on the end of the filename. It's quick!

New files for some formats should not be empty so you may run into problems with that. For example, a Zip file with nothing in it is actually a 22 byte file since it still has some header information inside it, and many programs will reject a 0 byte .zip file.

Files created via the New menu (and the FileType NEW... command) are not always empty. Some file formats specify a "template file" to be used when new files are created.

For example, create a new Rich Text Format file using the New Menu. It will be 16 bytes, not empty.

Empty files do work with quite a few formats, though.

[quote="leo"]Here we go (I think):

@set name={dlgstringS|Enter File Name|Readme.txt} copy FILE="nul" AS="{$name}" HERE select {$name}
[/quote]

I'm trying to utilize the above function with the addition of having the new file opened automatically by a text editor. I tried adding this:

C:\progra~1\vim\vim70\gvim.exe "{$name}"

This started the editor but didn't quite work since $name does not contain the full path to the file. I played around with some of DOs variables but had no luck.

Any ideas on things I could try to utilize (obtain) the path/filename?

Thank you,

[quote="Indy"]
I'm trying to utilize the above function with the addition of having the new file opened automatically by a text editor. I tried adding this:

C:\progra~1\vim\vim70\gvim.exe "{$name}"

This started the editor but didn't quite work since $name does not contain the full path to the file. I played around with some of DOs variables but had no luck.[/quote]

You need to give it the full path - try the following:

C:\progra~1\vim\vim70\gvim.exe "{sourcepath}{$name}"

Thanks - that works great!