Jump to content

Stephen_C

Community Hero
  • Posts

    1,344
  • Joined

  • Last visited

  • Days Won

    65

Everything posted by Stephen_C

  1. I'm not aware of any way of making Copy to Clipboard a default on file search result. Personally I'd always use a File Action or Universal Action. Stephen
  2. Background Having feasted amply on the hidden delights of Alfred's Keyword Input it's time to be served a small palate cleanser. A good worklow holds the hand of the user—even if it's your workflow and your hand being held. The ultimate hand-holding lies in a good and comprehensive Workflow Configuration. However, that's for another day. Today we'll look at prompts, Alfred's Dialog Conditional and Post Notification Output...with a tiny addendum. As background to those it's very helpful to understand variables and how they are used. Prompting the user When we expect something from a user it's really important to be clear about exactly what we expect. We saw an example of that when considering Keyword Input—where the second Keyword Input used a variable as part of the prompt for the second part of the phrase. In a similar way, if we create a Universal Action we need to ensure it has a helpful title so that the user knows what it does. However, there's another way to prompt the user… The Dialog Conditional Alfred's Dialog Conditional is very useful for providing feedback to a user. It may provide the result of the workflow with some alternative actions as in this example from my Word and character count workflow (on the Alfred Gallery): Alternatively we can use it to warn users of any error which occurs in a workflow (for example, trying to delete a non-existent file). Here's an example from my Save 'ur note workflow (also on the Alfred Gallery): Error trapping is an integral part of a good workflow. A user is an unpredictable beast and entirely capable of wandering into a workflow and breaking it. We can't trap every error but it's worthwhile considering and trapping those most likely to occur. When we do that we should always provide to the user a helpful error message—and the Dialog Conditional is ideal for that. Notifications Neither we nor another user should be left in any doubt that a workflow has actually done something. Any workflow which saves something, adds something to the clipboard or otherwise ends silently having achieved its goal really should end with a notification reassuring the user of success. Here's another example from my Save 'ur note workflow: We have reassured the user that the workflow has done what was requested but have also provided reassurance that the deleted file is in the Trash (should the user…well, you know!). Addendum: notes I think we should annotate our workflows. I know I'm obsessive about that but annotations (right click on any Alfred object and choose Edit Note…) are really useful. It's easy to forget what something does in a workflow and a note will remind us. If users also learn something from the notes that's a Good Thing too. In conclusion Palate cleansers, prompts, Dialogs Conditional, notifications and notes are all small items in the greater scheme of things. However, the small often makes the good… Service charge included: no tip required. Stephen The Simple Ideas posts
  3. I think the relevant question, in the context of your question, is: what are you trying to do with the file once you've copied it to the clipboard? Maybe once we understand that someone can give you a more useful answer. Stephen
  4. The workflow is designed (deliberately) to demonstrate what can be done when you wish to open one, frequently used folder. You seem to be looking for something more like Vitor's Thumbnail Navigation workflow (if I've understood correctly). Stephen
  5. Background Alfred's Keyword Input is more versatile than you might at first suppose. Of course you can use a keyword without any argument: I use one like that to open a deeply nested menu item in Day One. However there's much more you can do with the Keyword Input. The skeletal workflow Explanation 1. In order to set your teeth on edge we'll use the keyword Fraze. If we double click on the Keyword Input this is what we see: It shows the keyword we're using to trigger the workflow and indicates that should be followed by <space>, an argument then ⏎. The argument is the first part of the phrase. Note the title forms a helpful prompt we'll see when we trigger the workflow. Prompts are really important and helpful prompts really facilitate the use of workflows—so make use of them! If we trigger the workflow we can type the first part of our phrase: Note we've sensibly added a space at the end of the phrase because we know we're going to add a second part. However, never trust users! So, after… 2. Telling Alfred not close his window (explained in this post)… 3. We take control of spaces, decide to deal with them ourselves in order to avoid nasty surprises, so use an Automation Task simply configured (by double clicking on it) to remove trailing white space. 4. We save the first part of the phrase to a variable: We use a variable because we want to take control of assembly of the phrase. 5. It's time to prompt for the second part of the phrase and to reveal a very neat trick of Keyword Inputs: This time we don't use any keyword. This Keyword Input is simply a device to collect more user input in the course of the workflow. We still require an argument (the second part of the phrase) so we leave that as is. Note again we have a helpful prompt. This one reminds the user of the first part of the phrase by using the variable we created in 4 above but with an added ellipsis and quotation marks. 6. After again telling Alfred not to close his window… 7. We use another Automation Task to trim white space—but this time from the start of the second part of the phrase just in case a user has tried to be clever. 8. At last we can assemble the whole phrase: Our variable introduces and quotes the phrase and takes control of the spacing between the two parts of the phrase. 9. All we then need to do is to put our variable into Alfred's Large Type Output: so that when the workflow runs with our inputs it shows Your phrase is: 'Spam is significantly overrated'. You don't really need another screenshot just to show that it works, do you? In conclusion You can use a Keyword Input without a keyword to scoop up more user input in the course of a workflow—and, of course, you can do that as many times as you need. However, do remember to provide users with helpful prompts when they have to respond to any Keyword Input that requires user input. Stephen The Simple Ideas posts
  6. What versions of macOS and Alfred are you using? Where do you store Alfred's preferences? It may also be worth taking a look at this thread (starting with the linked post). Stephen
  7. Have you ensured your preferences are available off-line? Stephen
  8. 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
  9. Background We have dined upon cheese sandwiches and expanded the known universe but now it's time for a proper launch break. Alfred's Launch Apps & Files Action is extremely simple to use but there's a lot you can do with it. A skeletal workflow Explanation 1. In the Hotkey: box we have chosen, as the Trigger behaviour, to Pass through modifier keys (Fastest). (For a detailed explanation of how to do that see this Simple Ideas post.) The Related Apps tab is empty—because we are trying to launch an app. 2. We link the hotkey to the Launch Apps & Files Action which, when we double click it, looks like this: We have added the Messages app by dragging and dropping it into the relevant box. (That is a complete lie: I hate drag and drop so I clicked the little + sign and "did it my way”.) Note that we've ticked the box to Toggle visibility for apps. That means that we can use the hotkey to toggle the display of the Messages app: click to display, click again to hide. That's it: launch is all done and dusted…but is it? There is, in fact, another course (or two). Riffing launch You can add more than one app to the Launch Action: so it's very easy, for example, to launch all your chat apps at the start of the day with one hotkey. I do some photography and use both Adobe DNG Converter to process RAW files and Photo Mechanic Plus to enter metadata. When I want to process photos I need both of those apps but the first app I'll use is the Adobe one. If I launch both at the same time Photo Mechanic Plus will remain on top because it takes longer to launch. However, I can still use one hotkey to launch both apps because I simply separate the two launch actions (the first for Photo Mechanic Plus, the second for the Adobe app) with Alfred's Delay Utility set for a five second delay. Do you need regularly to open the same selection of files? Remember, the Launch Action is not merely for apps. Populate the Launch Action with the paths to the files you need to open (much easier to use that little + sign 😉), precede it with your hotkey, press the hotkey and your files are served. Of course, you don't have to use a hotkey trigger with the Launch Action. If, like me, you find it hard to remember all the hotkeys used on your Mac there's nothing wrong with using a Keyword Input. It may be worth pointing out that you can simply have a category called 'Launch Apps', or some such, in your workflows and put all your app launchers together on one page in Alfred's workflows. In conclusion Launch is ended, the table is cleared—and I trust no indigestion tablets are required. Stephen The Simple Ideas posts
  10. <Drowning noises off> I, too, moved from TextExpander the moment it went subscription. But, really, I'd be hard put to abandon Typinator: I have so much in it, including "mini-programs" that Do Things™️. While my brain is certainly small enough to fit in a Snippet 😁 I have reason to suppose you might be well qualified to prepare some sort of presentation on Snippets. 😉 Stephen
  11. Have you looked in /Users/[your username]/Library/Application Support/Alfred? Edit: If that doesn't help please confirm the versions of macOS and Alfred that you're using. Stephen
  12. Take a look at this Alfred help page: Script Environment Variables—and in particular the part about alfred_workflow_cache and alfred_workflow_data. Stephen
  13. There are detailed instructions for rebuilding the macOS metadata index on this Alfred help page: Troubleshooting File Indexing Issues. Stephen
  14. Background Approximately 13.8 billion years ago the universe exploded from a hot, dense soup of sub-atomic particles and has been expanding ever since. You are part of the expanding universe. Approximately 32 months ago Universal Actions exploded from Alfred 4.5 and have been expanding ever since. You can also be part of expanding Universal Actions: find out how—and why—it's better not to remain in a hot, dense state. There are few skeletons (just one) in this tiny cupboard in the universe: we don't start with a skeletal workflow. We have—horror—a non-standard layout for this "Simple Ideas” post. What are Universal Actions? At its most basic a Universal Action is an action in Alfred that acts on something you have selected: a file, a URL or text. However a Universal Action can also act on Alfred's results, file navigation or clipboard history (see below). Alfred has a large list of inbuilt Universal Actions. You can see them by opening Alfred Preferences → Features → Universal Actions and clicking on the Actions tab. While you're there you can un-check any that you don't want to see. How do I use a Universal Action? 1. You can first select something (a file, a URL or some text) to use a Universal Action. When you have done so you can use your Universal Actions Selection Hotkey (go to Alfred Preferences → Features → Universal Actions: it's ⌘/ by default) and that will display a list of Universal Actions relevant to what you have selected (i.e., text, file or URL). 2. You can also use Universal Actions on Alfred's search results, File Navigation and Clipboard History. In those cases, simply use your Actions shortcut to show the Universal Actions relevant to the appropriate item. (The Actions key is set in Alfred Preferences → Features → Universal Actions under Show Actions: and is → by default.) Here's what I see when I use Alfred to go to my ~/Downloads folder and then use →: (Your view will not be identical because you'll not have the same Universal Actions. Note also that Alfred remembers which Universal Actions you last used so the results will be ordered accordingly.) If I use Clipboard History, choose an item with text on the clipboard and press → I see this: Note that Alfred knows whether what you have selected is a folder or text (or, indeed, a URL). The beauty of Alfred's Universal Actions is that they're omnipresent (the clue may be in the name), intelligent and instantly accessible. I want to live in my own universe: how do I create a Universal Action? This is very easy. Here's a really simple example which converts text to lower case <produces following skeleton from cupboard>: We start with a Universal Action (which is probably not a major surprise to alert readers): We give it a name (remember, that's what's going to appear in our list of Universal Actions whenever, one way or another, we select some text), choose Text as its target and Single Input Arguments. (The alternatives are Single, Single and Multiple and Multiple: you can imagine the latter two are particularly useful when we're dealing with files, for example.) 2. Connected to the smart little Transform Utility… 3. …we simply then copy the result to the clipboard by using the Copy to Clipboard action in its default state. The result, of course, is that any capital letters in the text are now converted to lower case (you don't really need another screen shot, do you?). In conclusion 27% of the Alfred workflows I use (numbering just over 100) are Universal Actions (or use a Universal Action in addition to another trigger). Those of course, are in addition to Alfred's inbuilt Universal Actions. Perhaps that's some indication of their usefulness…and it didn't take (even) me 13.8 billion years (or even 32 months) to build them. P.S. Alfred's File Action Trigger is important in the context of Universal Actions but you will be relieved to know there is a limit to the amount that should be crammed into one post so that will be the subject of a separate post…at some time. Stephen The Simple Ideas posts
  15. Background This is the second of two posts exploring uses of Alfred's List Filter Input. The first post is here. Like the first post this workflow is not intended, of itself, to be useful but, rather, to provide a gentle introduction to use of Alfred's List Filter Input and to Using Variables in Workflows. (If you're new to variables it might be helpful to read this post first.) There are two things you need to know before proceeding. First, this workflow uses Alfred 5.5's Text View. Second, we're going to be working with markdown—but all you need to know about that is that to create a valid markdown link you have to use the format [The friendly name](The URL). The skeletal workflow Explanation 1. We're using Alfred's Alternative Actions and keeping Alfred's window open (see also this post). 2. This time we're going to use both variables from the selected list filter item (and I selected again—as in the first post—The Debugger). The list filter for that item shows the arguments as https://www.alfredapp.com/help/workflows/advanced/debugger/,the debugger. In order to use both variables sensibly we split them so we can assign them to meaningful variable names. This time we split them into variables and assign the prefix split. 3. Now we have the two variables we can prepare them ready to create the markdown link. Remember, we need [Friendly name](URL). At the moment we have two variables: split1 and split2. The first is going to be the URL so we create a new variable called, unsurprisingly, theURL and assign to that {var:split1}. In a similar way we assign to a new variable called theName our second split variable {var:split2}. Don't fall into the trap of referring simply to split1 and split2: you must tell Alfred these are variables and not merely pieces of text. (However, when, not if, you make that mistake and wonder at the strange result rest assured we've all been there.) 4. It's very easy now to create our markdown link by assembling our two variables and assigning them to a new variable: Note we are not using just the variables themselves. We add the relevant parentheses around them necessary to create the markdown link. Alfred simply treats those parentheses as pieces of text and reproduces them as such. Remember, we can't spit out a newly created variable from the Arg and Vars Utility in which it was created so (not passing anything through from this Arg and Vars Utility)… 5. We simply tell Alfred to pass on our new variable using another Arg and Vars Utility: 6. At long last (for those of you still awake at the back there) we have a clickable markdown link displayed in Alfred's Text View: In conclusion Sorry there was no time to serve the popcorn: there was much ground to cover. While superficially it may seem pretty basic stuff there's an awful lot you can do with simple variables, combinations of them and addition of text to them—as well as by using List Filters with multiple arguments. What's my use for a variation of this workflow? Ah, that's for another time. Stephen The Simple Ideas posts
  16. What versions of macOS and Alfred are you using? Where do you store Alfred's preferences? It may also be worth taking a look at this thread (starting with the linked post). Stephen
  17. Background Do not be frightened of variables! Variables are nothing more than little titbits saved in a pocket for future use—just like cheese sandwiches. Except, except…you wouldn't put a cheese sandwich straight into your pocket, would you? First you'd tenderly wrap it to preserve its identity through the vicissitudes of pocket travel. So you won't be surprised to know that variables are exactly like cheese sandwiches: they need wrapping too. The skeletal workflow Explanation This is a quick and reasonably useless workflow purely to demonstrate use of variables: please excuse both it and me. 1. We have a Universal Action limited to URLs (and we'll talk more about Universal Actions another day). All we do is to select a URL (remember, you always need to select something before using a Universal Action), press our Universal Actions hotkey, chose "Copy the URL” and press ⏎: 2. We don't want to close the Alfred window (which we covered in this post). 3. We're going to need to use the URL later in the workflow so we must pocket it in order not to lose it. That's what we do here: We use Alfred's Arg and Vars Utility. When we first open it {query} appears in the top box after Argument:. {query}, in this case, is the URL we just copied. We don't want to pass that on directly to the next item (the prompt for a friendly name) because if we do the URL will appear in the prompt field we have to complete. So we delete {query} if it appears after Argument:. What we do need to do is to save the URL as a variable. To do that we click on the + sign at the bottom of the Variables: box. First we give the variable a sensible name. That's important because we want easily to be able to recall what we called it. You can use any form of name you like—although I tend to use Camel case as here. After we've named the variable we must indicate what it contains. In this case it's very simple: {query} is what Alfred passed in to this Arg and Vars utility, so {query} is the URL and that's what we want to save to the variable. 4. Now, for the first time we're going to use a variable <cue sound of distant trumpets>. The prompt for the URL friendly name is this: Friendly name for '{var:theURL}' (Note you can use variables in prompts like that—as well as in things like notifications and dialogs—to make them more helpful.) It's very important to note that when we use a variable we must use its wrapped-up form so that Alfred recognises it as a variable. That form is {var:variableName}: so the only thing that changes from case to case is variableName. In this case we've encased the variable in single quotation marks simply to make look better in the prompt: 5. We don't close Alfred's window. 6. Now, in a blaze of glory and another Arg and Vars Utility, we assemble the final text: We use the saved URL ({var:theURL}), the friendly name (which Alfred has passed us as {query}) and a little bit of text between them. We want to pass the text to Alfred 5.5's Text View but we can't pass out a new created variable from the Arg and Vars Utility that created it so, while ensuring this Arg and Vars Utility is not passing out anything (blank Argument:, unchecked Pass through input argument), we… 7. Pass the text with another Arg and Vars Utility: Note, again, that the variable we saved as theText must appear here as a wrapped variable Alfred will recognise: {var:theText}. 8. Finally…in Alfred's text view {var:theText} is translated into Real (if uninspiring) English: In conclusion This was intended to be a short post but, obsessed with the variables of cheese and Spam and the need to provide a foundation for future simple ideas, it has not been so. I apologise. Please take a break, choose your favourite sandwich and munch while meditating upon the delights of variables. Stephen The Simple Ideas posts
  18. @sepulchra thanks for the ideas…but I think we need to come to some sort of arrangement. You see, I'm a little ashamed to admit that I don't use Snippets (I've used Typinator for years) so I think you should do the ones involving Snippets. 😀 However, I shall adopt Vitor's suggestion for a deconstruction of some of my non-code workflows—and, in doing that, cater for some of the ideas you mentioned. I'll just cover a little more basic stuff first and then, when we have all the building blocks in place, start with some of my basic workflows. Please feel free to continue to comment (your comments are always valuable) and to contribute anything along the same lines! Stephen
  19. Welcome to the forum. The very best thing to do is to follow carefully the steps outlined here: Troubleshooting File Indexing Issues. Try that and then report back if you're still having problems. Alfred 5.5 does work beautifully under Sonoma so it's well worth solving the problem. Stephen
  20. I am aware that Simple Ideas appears to have grown like Topsy. That was not originally intended but it seems now to have a life of its own. I apologise to those who find the posts tedious and too basic. They're not designed for those who chat in JSON and JavaScript over the supper table. If you are one of those people do please ignore the posts to avoid distress. I aim to post only on aspects of Alfred about which I have some basic understanding—which clearly bars me from any dive into Alfred's depths. I try to think of the posts in terms of what would have helped me when I first nervously dabbled trying to write workflows. Yet to come: Variables and cheese sandwiches I've got a little list…(2) Goodness knows what else (which means I don't) Ideas and comments are welcome—but please don't expect anything too sophisticated! Stephen
  21. Background This is the first of two posts exploring uses of Alfred's List Filter Input. If you don't know about List Filters do check the link because (a) they are very useful and (b) I shan't cover every aspect of them in these posts. This is not intended to be, of itself, a useful workflow but, rather, to show how List Filters may be used. The skeletal workflow Explanation 1. The List Filter starts the workflow and shows the keyword used to trigger it (ahp in this case). (If you sometimes see a keyword in italics that is because the keyword has been set in the Workflow Configuration.) Here's what the List Filter looks like when you double click on it: Note, at the top of the List Filter, we choose to have the keyword followed by a space and an optional argument. That allows us to see the entire list of items as soon as we type the keyword—and to press space followed by a typed search term to display the item we want. At the bottom right of the List Filter we choose "Alfred learns result order based on usage” so that frequently used items rise to the top of the list as we use the workflow (see Understanding Result Ordering). The key thing to note is that each item in the list has two arguments separated only by a comma. The first argument is a URL for an Alfred help page and the second argument is a friendly name for the page. The significance of the second argument will become apparent in the second of these posts. 2. Because we have two arguments for each item in the list and because for the purposes of this post we're going to use only one we use Alfred's Split Arg Utility to split the two arguments. Here's what it looks like when we double click it: We split with a comma (because that's how the arguments in the list are divided) and we output as arguments (because that's what we need in the next part of the workflow). 3. All we need is the URL (at the moment) so we just use a simple Automation Task to grab the first argument—with no Automation Task configuration needed. 4. We're home and dry! The URL is passed to the Open URL Action—which we have no need to modify if we wish the URL to open in our default browser. In conclusion I appreciate none of that is very exciting. However, in the next post we'll start messing around with some simple variables and use both of the arguments in the List Filter. Sadly no popcorn will be served but please remain in your seats. Stephen
  22. You should be able to use cmd + zero to toggle the window size. Stephen
  23. @sepulchra thanks for the kind comment. I'm currently doing a couple more (on List Filters but also covering basic variables in the process). I'm slightly conscious of the fact that some of these are getting rather long (particularly with all the screenshots) and don't want to "bomb" the forum! I'm unsure what the Powers That Be think of all of this 😁 but currently I'm prefacing the title of each with "Simple ideas:"—with the aim of making them easy to find should anyone wish to do so. Stephen
  24. Background I’ve posted this workflow before but I’m going to dissect it to show you some of the features available in a really simple but useful workflow. Of course, there’s an Alfred Universal Action to move a file or files but there’s also a way to create a quick shortcut to that Universal Action. That’s what this workflow does but it’s worth looking under the skin to investigate some of the details. The skeletal workflow The explanation We use a Hotkey Trigger rather than a Keyword Input because we want something that's quick to use. Double click on a Hotkey Trigger and take a moment to look at the options (see next screenshot but one). We choose “Pass through to workflow” as opposed to “Show Alfred”. The Argument is “Selection in macOS” because we’re wanting to move a file or files selected in macOS. If you click on the “Related Apps” tab you can add Finder in order to ensure the hotkey works only when Finder has focus: Tip: Use that to ensure your Alfred hotkeys work only in the apps where you want them to work—or to use the same hotkey in different apps triggering different features in each app. Return to the Hotkey Settings tab and click where indicated: Then you’ll see the following: We check “Pass through modifier keys (Fastest)” because we want the fastest possible reaction from Alfred when we have a file or files selected and we then press the hotkey. 2. The Action in Alfred dialog has a little trick up its sleeve (double click on the Action to open the dialog box): We limit the “Treatment:” to “File” and (the trick) change “Jump to:” from a blank to “Move to…”. That way we have instant access to Alfred’s “Move to…” Universal Action. (The other things to which you can jump, bypassing the list of Universal Actions, are Recent Documents…, Open With…, Open URL in…, Email to…, and Copy to… .) In conclusion When using a workflow like this all you need to do to move a file (or files) in Finder is to select it (or them), press the hotkey and start typing, in Alfred’s window, the name of the folder to which you wish to move the file or files. When the relevant folder name is displayed simply press ⏎ to move the file or files to it. But even in a simple workflow there’s a lot going on behind the scenes. Stephen
×
×
  • Create New...