This is an Alfred workflow that makes a new text file in the style of the Mac Finder.
This version requires Alfred 5
It works with three commands:
- New File
- nf
- ⌘ ⌥ N
These will each create a text file in the front most open folder or on the Finder desktop.
It follows Finder rules.
The default name of the file is “untitled”.
⌘ ⌥ N can not take a parameter so the file will be created, with it’s name “untitled” selected. Just start typing to change it.
New File & nf can take a name as an optional parameter. So nf magnum opus.txt
will create a file name “magnum opus.txt”.
If you make a file with a name that is already in use in that folder the name will be appended with “ 2”, then “ 3” and so on.
It respects your file extension while dealing with duplicates. So if “magnum opus.txt” exists then “magnum opus 2.txt” will be created.
Hint: Because the file is selected in the Finder ⌘↓ will open the file in it’s default app.
New File Finder Style also has an external trigger. This allows the workflow to be triggered from Applescript. With the trigger ID of trigger.nf from the workflow ID of com.buttergut.nf
tell application id "com.runningwithcrayons.Alfred"
run trigger "trigger.nf" in workflow "com.buttergut.nf" with argument "test"
end tell
Hint: I used this to make the New File Button in the Finder. Just drop the “with argument...” bit at the end of the line and it defaults to “untitled”.
You can take a look at the button here: New File Finder Button