Jump to content

Stephen_C

Community Hero
  • Posts

    1,360
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by Stephen_C

  1. 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
  2. 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
  3. There are detailed instructions for rebuilding the macOS metadata index on this Alfred help page: Troubleshooting File Indexing Issues. Stephen
  4. 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
  5. 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
  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. 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
  8. @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
  9. 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
  10. 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
  11. 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
  12. You should be able to use cmd + zero to toggle the window size. Stephen
  13. @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
  14. 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
  15. @moonshot you don't need to do anything more to copy the image to the clipboard: the final Automation Task in the workflow does that for you. All you should now need to do is to use ⌘V to paste the image where you want it. Stephen
  16. It's not clear that you're first selecting something (e.g., text, a URL, a file) and then applying your Universal Action hotkey. You must first select something and then apply the hotkey. Stephen
  17. @moonshot don't be discouraged: you're getting pretty close. If you're starting with a keyword you don't need to complete the workflow configuration (when the workflow is for your own use). Simply double click on the keyword action and type the keyword you want to use. Similarly, you can add directly the path to your screenshots folder by double clicking on the first Automation Task (Folder Contents This shows you how to access the dialog to change the Alfred window behaviour: Then just check the Window Behaviour box towards the bottom of the dialog. That will change the connector icon from a circle to a square. Stephen
  18. @moonshot there was no loom video attached. However, it would probably be more helpful if you were to do the following: open the debugger; run the workflow on some selected text (making sure that you use your Universal Actions hotkey); copy and paste the results of the debug output in this thread. Stephen
  19. Background Many times a day I open my ~/Downloads folder in various sizes and shapes of window. However, I have a preferred size and shape for that Finder window and, with a very simple Alfred workflow, it's easy not only to cater for that but also to add some useful options. The skeletal workflow The explanation 1, 2 & 3 are all you need for the basic workflow. The remainder are the icing on the…workflow. I use a Keyword Input because I find it difficult to recall all the hotkeys used in my various apps. Of course, you could use a Hotkey Trigger if you wish. This is a simple Open File Action containing the path to the folder you wish to open. We use an Automation Task to set the bounds of the Finder window exactly was we want them. This is where we are Using Alternative Actions so that ⌥⏎ will take us along the new path in the workflow. Note, in the same Action, we also tell Alfred not to close Alfred's window in order to prevent flickering. (To access the Alternative Actions simply double click the round marker along the connecting line after an input object.) An Automation Task passes the contents of the folder (choosing, in my case, to sort by most recently added) to… Alfred's Grid View—where we can see the contents of the folder displayed in a grid (set to "Keep the results in order defined”). In that view we can search for any item, use ⌘O ("O” for "open”) to open any selected item in its default app or just press ⏎ to move on to action the item in Alfred. Again we keep open Alfred's window (as in 4 above). The Action in Alfred action provides access to Alfred's Universal Actions appropriate to the selected item (allowing you, for example, to delete or move the item, open it in Finder, etc.). In conclusion Sorry for the long-winded explanation of a very simple workflow. Once you have it up and running you may, like me, use it many times a day and everything very soon becomes second nature. Incidentally, there's a splendid workflow from Vitor on the Alfred Gallery called Thumbnail Navigation which allows you to navigate the file system with previews…so you may never need anything similar to what I've described here. But you don't learn as much using other's workflows as you do when writing your own, do you? 😉 Stephen
  20. Apologies for the earlier rush. While lunch bubbles away on the hob I've had time to be a little more helpful. I think something like this might work for you: Automation Tasks are very helpful here.In the first one all you have to do is to choose the right task then click on the folder icon in it and choose your screenshots folder. Then when you press whatever hot key you choose the contents of that folder will be displayed in the Grid View. Press ⏎ on a selected image to see it in Image View and ⏎ again to copy it to the clipboard (using another Automation Task). Does that help—or does it still feel too cumbersome? Stephen
  21. You should just be able to drag and drop the workflow in transfer.sh. Not so far as I've been able to discover! I'm a little involved cooking lunch just at the moment 😀 but in essence what you want to try (assuming you're using Alfred 5.5—which is the latest version) would be something based on my Search for PNGs workflow. You'd want to take various pieces of that (e.g. passing on folder contents, filtering them and the Grid View and Image View) and then linking the Image View to the Copy to Clipboard output. Sorry this is not, for the moment, more helpful: I'm a little short of time! No doubt others can help if all of this is still challenging. Rest assured, what you want is do-able. Stephen
  22. Sadly I can see you on the video but the demonstration of what you wish to do is blank. However, if you already have a workflow to open your screenshots folder and display the screenshots it may simply be a matter of adding to that workflow a Copy to Clipboard output (if appropriate checking the option to paste to the frontmost app). You may need to check what the default output option is from the screenshot display (see the commands at the bottom of the display) but it's possible one of them is already "Copy to clipboard”. If all of this seems double Dutch (with no disrespect to the Dutch) it would be helpful to upload somewhere (like transfer.sh) the workflow you want to try to modify so we can see exactly what needs to be done. Stephen
  23. For an idea for a rather less sophisticated workflow to send Messages (which, I'm afraid, involves listing your contacts' names and numbers in a list filter) see this post. I appreciate it's not so good as the workflow in this thread but it may help some who can't otherwise get results from the workflow under discussion. Stephen
×
×
  • Create New...