Stephen_C Posted April 7 Share Posted April 7 Background We know that Universal Actions can intelligently divine whether we are dealing with some text, a URL or files. So what's the point of having a trigger that's a specific Universal Action for files? Alfred's File Action Trigger in fact provides us with much more control when dealing with files than do more general Universal Actions. Open wide…let's pop in the skeletal workflow. The skeletal workflow Explanation We have a very simple workflow: all it's designed to do is to copy to the clipboard the contents of any single text or markdown file that we select. 1. The File Action Trigger is the secret of this workflow. Here's what it looks like when we double click on it: It allows us to restrict the types of files which, when selected, result in this workflow showing in our list of Universal Actions. Obviously we don't want to attempt to copy to the clipboard the contents of any binary files, for example, so we drag and drop into the Types: box samples of the files we do want to include. (If we use the + sign to add file types we're going to need to know the Uniform Type Identifier—UTI—of each file type that we add…so maybe drag and drop is easier in this case.) The Name: is what will appear in our list of relevant Universal Actions when we select an appropriate file so it's worth making sure we choose a helpful name. In this case we have selected Single Input Arguments because it makes little sense trying to copy to the clipboard the contents of multiple text files (the alternatives are Single and Multiple and Multiple: both of which are useful when dealing with operations like moving and copying files, for example). 2. We link to a File Contents Automation Task—with no configuration of the task required—to retrieve the contents of the file so that… 3. We can simply copy the contents of the selected text file to the clipboard. In conclusion Alfred's File Action Trigger, with its tailored, selective action, is very useful when you want a Universal Action linked to a specific file type (or, indeed, to various specific file types). We can stop chewing but some time—in the dim, distant future when the universe has expanded even more—we may again examine file actions in the context of a deconstructed workflow. Stephen The Simple Ideas posts sepulchra 1 Link to comment
sepulchra Posted April 17 Share Posted April 17 I love the File Contents automation task. It is so incredibly useful. vitor 1 Link to comment
vitor Posted April 17 Share Posted April 17 1 hour ago, sepulchra said: I love the File Contents automation task. It is so incredibly useful. And so incredibly simple. A contender for the shortest code: /bin/cat "${@}". sepulchra 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now