Button to create txt file

Hi guys,

I want a button to create a EXAMPLE.txt empty file in the current folder. This should be easy, but I don't find how to make this work, any ideas?

I've been trying with

copy con EXAMPLE.txt

but this doesn't work, I need the ^Z.

Thanks!

All you need for the basic button command to do that is:

FileType NEW =".txt"

However you can make it a little more specialized for your needs by doing something like this:

Select NONE FileType NEW=.txt NEWNAME="norename:ReadMeJohn" Select PATTERN="ReadMeJohn.txt"

Or something like this: the following code not only creates the new file, it prompts you for a name:

FileType NEW=.txt NEWNAME="norename:{dlgstringS|Enter filename|example.txt}"

FWIW, the basic FileType NEW=".txt" in John's post will also prompt you for the name (in a slightly different way to the one in Christiaan's post).

Wow, that's fast. Perfect, thanks!

Uhm, it works well for .txt and .docx, but what about .doc? It doesn't work, that's weird.

Does the usual New -> Doc context menu work in Opus? If not, does it work in Explorer?

Sure, but it creates .docx by default.

Opus can only make a new file if there's a template available for it. It looks like Office 2007 only provides templates for the "new" file formats and not the legacy ones.

It should work when you add this to the registry (it works for me):

[code]Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes.doc\Word.Document.8\ShellNew]
"NullFile"=""[/code]

I found it here (New Context Menu Blank Doc Document): technize.com/2008/09/06/chan ... cx-to-doc/

You can use this if you want to create a new, empty .doc file when there isn't a .doc template on the machine:

FileType NEW=.txt NEWNAME="New Document.doc"

This is only good for filetypes where the programs that open them know what to do when faced with an empty file. It won't work with .Zip files, for example, since most programs will view a 0-byte Zip file as corrupt.

I keep meaning to make this a FAQ since it comes up a lot. I realised there was already a related post in the Buttons forum, so I fleshed out the remaining details (in my reply to the post) and have linked it from the FAQs:

That works perfect, Leo, thanks. Great job with the forum.