Write Text File Output
The Write Text File object is a convenient way to write the output of your workflow to a file. You can create a new file, append text to an existing file, or overwrite a file with a new one.
Using the Write Text File Output
Connect the output of any object to a Write Text File to write the passed-in content. You can use variables and the {query}
from the previous object anywhere in the creation of your new file.
In the example above we used the {query}
input from the previous Keyword object as the name of the file to create, and {clipboard}
to save it with the clipboard contents.
The button in the bottom left with curly brackets provides examples of date and time, arithmetic, and clipboard content. See the Dynamic Placeholders page to find out more.
Object Configuration
File creation behaviour
If the file already exists, you can choose from the dropdown to skip, overwrite, append, or prepend to the existing file.
You can also:
- Add a UUID (universally unique identifier) to the filename, useful when creating temporary files.
- Create intermediate folders, if the path you specify doesn't already exist.
- Allow empty files to be created.
Choosing Which Folder to Write To
When setting a relative path, Write Text File can:
- Write to workflow's data folder: intended for local data which seldom changes. These files will not be exported with the workflow or synced.
- Write to workflow's cache folder: for temporary or frequently-updated data. These files will not be exported with the workflow or synced.
- Write to the workflow folder: for data you want to store with your Workflow. These files will be exported with the workflow or synced.
Workflow Example Using the Write Text File Object
The Simple To-Do List example workflow, included in Alfred, will show you the Write Text File object used to create or append a new task to one of three to-do lists.
You'll find it in the Getting Started guides and examples in Alfred, under the [+] button at the bottom of the Workflows sidebar in Alfred's preferences.