If you want to create a button or menu item which creates a new file, in the same way that the “New” context menu creates new files of different types, then you can use a command like this:
The command above only works for file types that have a “template” for creating new files; essentially, the types that appear when you right-click the background of Opus or Explorer and open the New menu.
If you have Microsoft Word installed, then this command will create new Word documents:
But if you don’t have Word installed, the command above may not work, as there probably won’t be a template on your system for creating new .doc files. There is a way around that.
The command below works with any file type (.doc is used in the example) and will create an empty file with the specified name and then select the name (not including the extension) so that you can type over it:
FileType NEW=.txt NEWNAME="New Document.doc"
That tells Opus to create a new file using the .txt template (which is always a completely empty file) but to name it “New Document.doc.”
The command above is only safe if the programs associated with the file type (.doc in the example) understand what to do with completely empty (0 byte) files. Some programs or file types will not work with this. For example, “empty” zip files must still contain a 22-byte header in order to be valid. Luckily, there is almost always a template zip file so the basic
FileType NEW=.zip method works fine for them.