Make a Text File with the Shortcuts app on Mac and iOS

The video version of this tutorial

This was a request by the user Jahankykong in a comment on my video on how to make Nested Folders with Siri Shortcuts, so shoutout to them.  And be sure to check out that video if you haven’t.

In the case the user mentioned, they might want to have a little “Read Me” text file in a nested folder structure they create to act as instructions or guidelines for clients.   What we’re going to do is have Shortcuts write some text, make it create a .txt text file out of that text, and save that file to a particular location.  I’ll show you some other settings along the way in case you want to tweak this yourself.  This will work the same way using the Shortcuts app on your iPhone or iPad as it will on your Mac.

One thing to note is that on its own, Shortcuts can’t create that many different file types.  It can create .txt files and PDF’s, but if you want other file types, you’ll need to install other document apps that can plug into Shortcuts.  Apple’s own iWork and third-party tools like BBEdit are 2 examples of this.

The Basics

Open up the Shortcuts app and make a new Shortcut (or open the one you’re working on. Go to the Action Library in the sidebar, look for the “Text” action.  Its icon is a default yellow text action icon.  Once you’ve found it double click or drag it into the workspace.  Now in that box you can type the text you want in the text file.  This is a plain text file, so you won’t be able to add anything like bold or underlined text, but you can write multiple lines in the box so that it’s more readable. 

The text action after searching for it in the Action search bar.
The text action

Once you’ve typed out the text, we need to make it into a text file.  Back in the Action Library, look for “Append to Text File” action, which will be an icon with blue lines and an arrow on it.  Adding that to our workspace below the text action we added earlier, you’ll see Shortcuts has already connected it to the Text we typed above with the little connecting line here and the “Text” tag in the action itself. 

The Append to Text File action in the Actions search bar
The Append to Text File action

Now we need to tell it where to put the file, and what to name it. To name the file, type in what you want the file to be named in the “File Path” box.  You can put .txt at the end of the file name for consistency, but the action will do that for you if you don’t. 

The final product - the workspace with the text action with typed text followed by the append to text file action converting it to a dot t x t file and giving it a name.
The final product (minus the location being set)

So where is this file going? Are you setting it in an unchanging location, or will it be dependent on something else?  If you know the file will be going in the same place every time, click where it says “Shortcuts” and then hit “Replace” in the drop-down.  Now you’ll navigate through the file menu for the folder you want, and then hit “Open” so that text file will always be created with that name in that specific folder when this Shortcut is run. 

Custom Location Placement

The Nested Folders with Text File real world example
The Nested Folders with Text File real world example

But say you need to it to be a different folder each time or in the directory of a folder you just created.  Here’s a real-world example in the picture above: this is a copy of my nested folder Shortcut I created some time back that creates a project folder with the name I give it, then creates 4 sub folders within that new folder.  In this case, I want to adjust it so that it adds the text I’ve typed here as a text file into one of the folders, say the root folder of my project. 

I’m going to add Text action and the “Append to Text File” action and give the file the name “Read Me”.  Now I need to set the root folder.  I’m going to right click the “Shortcuts” section of the Action and hit “Magic Variable”. 

The Nested Folder workspace with the Magic Variable setting activated so we can select the proper "Created Folder" section.
When The Magic Variable setting active, you’ll see a blue bar at the top and little blue text boxes showing the action’s results below them.

You can now see the Shortcuts workspace has broken up its chain of commands so I can see where actions are triggered, or folders are created.  I’m going to select the first “Created Folder” input near the top because that’s where the root folder is created.  Clicking on that selects it as the magic variable and changes the Append action from “Shortcuts” to “Created Folder”. 

Now, if I run the command from “Quick Actions” here on the desktop (and name the project “Demo”) you can see that I now have my 4 nested folders and the Read Me text file next to them. 

Feel free to comment.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.