How Do I Paste a file (create a blank file) into the Finder in current Folder?

I'm trying to paste a blank text document into a Finder path with a keyboard shortcut.

KM pastes the file fine into a document but it won't paste it into the Finder.

Essentially, I'm trying to copy a blank document wherever I happen to be when I use the shortcut.

Duplicating and moving doesn't work since it asks for a specific path. Any ideas?

In case I'm being dumb, here's why I'm trying to accomplish this; I'm trying to save the hassle of having to open up text editor, creating a new document, finding the save path to the place I want it to be. I'd rather just paste a blank, double click and begin writing. If there's an easier way to do this I'd love to hear it.


It is never dumb, in fact it is smart, to clearly state your manual workflow that you want to automate.

Here is a macro, as an EXAMPLE, that should do the job. Review it carefully before you run it, since it can/does overwrite existing files.

Let us know if this works for you.

##example Output

##Macro Library   @Finder Create Blank Doc in Current Finder Folder @Example

<a class="attachment" href="/uploads/default/original/2X/7/7d47c738dce4fce85d58fdabf428a788fe46900a.kmmacros">@Finder Create Blank Doc in Current Finder Folder @Example.kmmacros</a> (8.5 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


###How To Use

* Open Finder to the Folder where you want the new blank file to be created.
* Trigger this macro
* Accept default file name of "BlankFile.txt", or enter different name.
* File will be created in the Finder Folder (Insertion folder)
* File will be opened in the user's default app for that file type.




**NOTICE: This macro/script is just an _Example_**

* It is provided only for _educational purposes_, and may not be suitable for any specific purpose.
* It has had very limited testing.
* You need to test further before using in a production environment.
* It does not have extensive error checking/handling.
* It may not be complete.  It is provided as an example to show you one approach to solving a problem.


* **Carefully review the Release Notes and the Macro Actions**
  * Make sure you understand what the Macro will do.  
  * You are responsible for running the Macro, not me.  😉
* Assign a Trigger to this maro.
* Move this macro to a Macro Group that is only Active when you need this Macro.
* ENABLE this Macro.
  * ALL Actions that are shown in the magenta color


* While I have given this limited testing, and to the best of my knowledge it will do no harm, I cannot guarantee it.
* If you have any doubts or questions:
  * **Ask first**
  * Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.


<img src="/uploads/default/original/2X/a/a6e019fba83637e3592ce366a2676d74ab5832a0.png" width="485" height="1473">

thanks for the comprehensive answer. Trying It now.

This works flawlessly. Thank you so much for your help.

Hello again,

I'm just wondering whether it's possible to change this so that the highlighted text when the file is creates does NOT include the extension. That way I can just begin typing and then save.

Currently I have to select the title text and then begin typing.

Yes, this is very doable. First, in this Prompt for User Input action:

Change "BlankFile.txt" to just "BlankFile" (or even leave it blank) so that the extension is no longer there by default:

Then, to add the ".txt" extension automatically, insert a new "Set Variable to Text" action immediately after "Prompt for User Input" that sets the CBD__BlankFileName variable to %Variable%CBD__BlankFileName%.txt:

When finished, that section of the macro should look like this:

1 Like

Hallo @gglick,

Your workflow help was fantastic but, alas, after four years something's happened.

Could be Ventura but now when I run the app it puts the file in the enclosing folder, not the folder I've got open.

Any idea why this could be?

Hey James,

Please post your macro, so we can test.


FWIW I tend to use an Execute Shell Script incantation of the form:

touch filepath

The touch utility sets the modification and access times of files. If any file does not exist, it is created with default permissions.


Another possible route:

Create a New File in the Finder from a Selection of Templates - #10 by ccstone

1 Like

I think it's because there's a missing / in the "Write" action's path -- try adding it between the two % symbols so it reads

1 Like

You're a saviour.
I wonder how on earth that happened.

It's been "missing" since 2017, so I suspect there's been a change in the OS's behaviour since then -- if you look at the original screenshots above you'll see %FinderInsertionLocation% includes the trailing / in the returned path, but it doesn't in Mojave 10.14.6 (which is what I'm currently in front of).

Have you just jumped from High Sierra to Ventura? If so, you may be in for a few more shocks!

Ha. No, I’ve not. Always been up to date. No idea what changed.