Button to Create a new text file

Hi, does anyone know how I can make a button that creates a new txt file?

Easy:

FileType NEW=.txt

I use the following which not only creates the new file, it prompts you for a name and disables the inline rename.

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

By way of explanation, I use the second method simply because I use the button as a generic "create new file" function. Whilst the prompt is pre-filled with "temp.txt" it's all selected allowing me to easily create different filetypes by just typing. Using the standard inline rename requires an extra step to select the extension to change it.

cheers! you are a star! :astonished:)

I just use on Function:
"c:\Windows\Notepad.exe"
on a button to open Notepad or what ever you want

[quote="tanis"]Easy:

FileType NEW=.txt

I use the following which not only creates the new file, it prompts you for a name and disables the inline rename.

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

By way of explanation, I use the second method simply because I use the button as a generic "create new file" function. Whilst the prompt is pre-filled with "temp.txt" it's all selected allowing me to easily create different filetypes by just typing. Using the standard inline rename requires an extra step to select the extension to change it.[/quote]

This function is great :astonished:

thanks very much tanis :wink:

How to open the newly created file (in that single command), immediately after creating..

Most text editors will create a new file if you give them the name of one which doesn't exist yet, so you can use a button that does something like this:

"C:\Metapad.exe" "{sourcepath$}/{dlgstringS|Enter a name:|temp}.txt"

(The button originally came from Tanis's reply to this thread.)

There is a limitation in this...

In the command that Tanis mentioned earlier, we can create a file of ANY FILETYPE.
But, the "open" command applies only to .txt files and only the text editor.

Probably, can we use a command to select the most recent file and open it?

I think, I was not too clear in my previous posts..
I will re-frame my request now

When I use Steve's command (the second one), a new file of the required type can be created.

After a new file is created, the next step would invariably be 'opening the file'

But, after creation, the new file is not selected automatically.. so, I need to take some extra steps to select the file..
this is esply boring when there are a lot of other content in the folder

So, is there a way to have the file selected by default, on its creation? ..so that, a mere pressing 'enter' thereafter, will open it.

Here are a couple of threads on that:

resource.dopus.com/viewtopic.php ... ype+select

resource.dopus.com/viewtopic.php ... ype+select

Thanks for the links!
I cooked up a few codes to finally end up with this :slight_smile:

@nofilenamequoting @set fn={dlgstringS|Create New File|name.ext} FileType NEW=.txt NEWNAME="norename:{$fn}" Select PATTERN="{$fn}"