Jump to content

Stephen_C

Community Hero
  • Posts

    1,330
  • Joined

  • Last visited

  • Days Won

    64

Stephen_C last won the day on April 17

Stephen_C had the most liked content!

2 Followers

Profile Information

  • Location
    London, UK

Recent Profile Visitors

2,421 profile views

Stephen_C's Achievements

Advanced Member

Advanced Member (5/5)

351

Reputation

  1. Please work carefully through all of the suggestions on this Alfred help page: Troubleshooting File Indexing Issues. If you still have problems after doing that please follow the suggestion under "Still having issues?” and post the results here. (If your Alfred oreferences are stored in Dropbox do ensure they are made available off-line: Syncing Your Alfred Settings Between Macs.) Stephen
  2. Please provide the information requested in this post higher up the thread and also confirm your version numbers of Alfred and macOS. Stephen
  3. You may find this post (and the remainder of that thread) helpful. Stephen
  4. It has long vexed me that my workflow does not retrieve for me the name of the destination workflow. Version 2.0 remedies that lacuna so that now all you have to do is to check that the name of the destination workflow is correct and then press ⏎: The workflow now provides a fast way of including images in a workflow configuration. (There are still no dependencies.) Stephen
  5. Background After a full tasting menu of "Simple Ideas” for this final post in the series we return to a starter. It's an entirely random collection of points that I wished I knew when I first started dabbling with workflows in Alfred. Bear in mind these really are "simple ideas”. How can I have multiple user inputs? The answer, in the context of what I needed, was to use two Keyword Inputs. How do I include screenshots in the workflow configuration? Put the screenshots in the workflow folder (right click on the workflow name in the second column in Alfred's Preferences then choose Open in Finder)—or in a sub-folder of that folder if you wish. I now always place mine in a folder called Images within the workflow folder. As the workflow configuration uses markdown you can then refer to any screenshot like this (for example): ![Exact name of your workflow](Images/theUA.png) Note: you must include the initial ! and, within the square parentheses, the exact name of your workflow. Although it's not proved to be one of my more popular workflows on GitHub I always use my Create UC image markdown link workflow to create the relevant link for me. ('UC' simply refers to 'User Configuration'.) How to check in a workflow if a 'Find' action has failed In my Find and replace text workflow on the Alfred Gallery I needed to trap the error that resulted from a user searching for text that did not exist within the selected text. Vitor's simple solution worked perfectly. How to use a tmp folder in a workflow Prompted by Vitor I've made use, where appropriate (for example in my Shrink JPEG/PNG files workflow on the Alfred Gallery), of a temporary folder which will get deleted on the user's next reboot. How to use more than one argument in a list filter We have already examined this of course—but it was something that I needed to learn when dabbling with workflows. How to annihilate rougue new lines Applescript is not a "simple idea” but, merely in passing (because perhaps you'll come across the problem in other contexts), it has a habit of adding new lines at the end of arguments it spits out. That can be very trying when you're trying to assemble variables but can instantly be solved by using Alfred's Transform Utility—the default action of which is Trim Whitespace. Of course, we've also looked at another way of doing that. How to open Alfred's preferences quickly If you use ⌘+ <space> as Alfred's hotkey hold down ⌘ and press first <space> (to bring up Alfred's window) and then (while still holding down ⌘) press , (comma). It takes very much longer to explain than it does to do. In conclusion That's it (you will doubtless be relieved to know) for the current series of 'Simple Ideas' posts. To those who still remain seated, if not transfixed, thank you for your patience. It would be good if you managed to learn something but, if not, just be happy if you were not provoked to throw anything at your computer screen while reading the posts. Stephen The Simple Ideas posts
  6. Background This Simple Ideas post (the penultimate one of the series for the time being) is different. There's no skeletal workflow, no painful dissection of any living thing—merely a few little tips for anyone who ever writes a basic workflow that simply sulks and does nothing (assuming that is not what it was designed to do). I am quite sure these are not mistakes that you commonly make but I am at least, let's say, familiar with them. A check-list for sulky workflows 1. Check for typos. 2. Check for typos. 3. Check for typos. It is horribly easy to refer a variable with the tinest of typos in it (or even to create one like that and miss the typo when using the variable) and then spend hours wondering at the sullen silence of the workflow when it is run. 4. Package your variables. Remember Alfred has no idea whether theChosenOne is a variable you previously created or an obscure piece of text unless you tell Alfred: so, {var:theChosenOne} please when you use the variable! 5. Have you duplicated a Hotkey Trigger or a Keyword Input? If either is already used by another existing workflow you're not going to get the results you expect from your new workflow. 6. Have you carefully created a variable but then omitted to pass that variable to something in the workflow that expects to receive it? Remember, you can't create and pass on a new variable in the same Arg and Vars utility. You will need another Arg and Vars utility to pass on the newly created variable to whatever it is that expects to receive it. 7. Have you, alternatively, passed to something in the workflow a variable that object should not receive? (The classic example of that is using a second Keyword Input to gather user input but passing to it the input from the first Keyword Input. In that case the second Keyword Input arrives carefully pre-filled with the input from the first Keyword Input…which is probably not what you want.) It is by no means uncommon to have to use an Arg and Vars utility with everything in it completely blank—to ensure that nothing is passed to the next object in the workflow. 8. Have you provided an alternative path in your workflow but forgotten to specify the Action Modifier? 9. Have you simply overlooked completing a variable in an action that expects it? (A number of Automation Tasks allow you to specify, within the task, the variable the task is to process. In a similar way you can specify a variable within the Large Type Output and Copy to Clipboard action.) 10. Are you seeing odd results when pressing esc (perhaps expecting to end the workflow)? Check whether you've told Alfred not to close his window in a place where you should not have done. Call the emergency services Stop: don't do it! The emergency services in this case consist of bug-catchers provided by Alfred: the debugger and the Debugger Utility. Both are invaluable when attempting to beat a sulky workflow into submission. If you open the debugger (⌘D is the easy way) for the relevant worklow then run the workflow Alfred will show you, in the debug window, exactly what the workflow is doing when it runs. Examination of the results can often assist in identifying where things may have gone astray. Further, you can attach the Debugger Utility to any object in your workflow to check what is being passed out of that object and the value of all variables that exist at that stage of the workflow. In conclusion No workflows were harmed in the creation of this post. Stephen The Simple Ideas posts
  7. This is not really a question for Alfred but, rather, for CleanMyMac support. You really should contact them. I do hope that you can find a way of accessing your backups though. Stephen
  8. Background I thought it was time to bring together some of things we've covered in the the Simple Ideas posts and to deconstruct a simple workflow. The one I have chosen is my Word and character count workflow from the Alfred Gallery. Be warned: this dissection is painfully slow and detailed which some readers may find distressing. The skeletal workflow Explanation 1. We start with a simple Universal Action limited to Text and Single Input Arguments. It's called, unsurprisingly, Word and character count—because we want users to recognise it in the list of Universal Actions that appear when text is selected and the Universal Actions hotkey is pressed. 2. The first thing the workflow needs to do is to save the selected text as a variable because, as you'll see, we need to do something with the text later in the workflow. Thus a variable theText is created with the value {query} (because {query} is what Alfred passes out of the Universal Action and into the first Arg and Vars Utility.) We have the text stored for subsequent retrieval. In the Arg and Vars Utility we check Pass through input argument because we want the selected text to pass to the next item in the workflow. (Remember, we can't create a variable and, in the same Arg and Vars Utility, spit out that variable to be passed to the next item in the workflow. So the easiest way here, to avoid using an additional Arg and Vars Utility to pass on the text variable, is simply to pass through the input argument.) 3. The Text Metrics Automation Task, which we set to count Words (double click on the Automation Task to select that), eats the selected text and outputs the number of words in it. 4. We don't want to lose the word count so we immediately create a wordCount variable with the value {query} (the value that passed into this Arg and Vars Utility). We have the word count stored for subsequent retrieval. This time we don't want to pass through the input argument (i.e., the number of words) but we do want to feed the text to the next item in the workflow. We set the argument to be passed on as {var:theText}: the text variable we created in 2 above. (Remember, variables need to be packaged so that Alfred recognises them as variables; so we don't simply use theText but, rather, {var:theText}.) 5. The text ends up in a second Text Metrics Automation Task—this time set to count Characters. This Automation Task devours the text, digests it and regurgitates the number of characters in it… 6. …which we promptly save for later retrieval. We create a new variable charCount and assign to it {query} (which, for those of you still awake, is of course the character count passed in to the Arg and Vars Utility). We have the character count stored for subsequent retrieval. We choose not to pass anything out of this Arg and Vars utility because we now have all we need to assemble some helpful text for the user. 7. We're going to present the user with the analysis and also a couple of choices so we use a Dialog Conditional. We provide the dialog with a title identical to that of the workflow. In the Description we set out what we wish to user to see in the dialog. In this case it's obviously a sensible summary of the result of running the workflow—interspersing with appropriate text the relevant two variables that we created so that the user will see something like this: It is worth noting two other things. First, we politely enquire what the user would like to do next—which directs the user's attention to the two options provided. Second, we ensure that the most likely option is that displayed for Button 1. The reason is that option will by default be highlighted by Alfred so that all the user has to do to select it is to press ⏎. 8. If the user does select to copy something to the clipboard we've chosen here, in the Copy to Clipboard object, to copy: Words: {var:wordCount} Characters: {var:charCount}. Remember, the copy to the clipboard is going to happen silently so it's only polite to let the user know it's actually taken place. 9. Accordingly, here's a little Notification Output that contains simply the title of the workflow and the following for the Text: field: The numbers of words ({var:wordCount}) and characters ({var:charCount}) have been copied to the clipboard. Note we again use the variables we've saved in order to make the notification rather more informative that it might otherwise be. In conclusion I hope that leaving the tattered remains of this workflow for all to see might, for some at least, have proved useful. To those deeply distressed by the painstaking, and no doubt painful, dissection I apologise. Stephen The Simple Ideas posts
  9. Background Alfred has several ways of displaying text: it can be copied to the clipboard or displayed in a Dialog Conditional or in a Large Type Output. Alfred 5.5 has introduced a Text View object. We passed over it when discussing variables and cheese sandwiches but shall now take another look at the Text View revolution—enabling us to have text served to us on a plate. The skeletal workflow Explanation The workflow is simple. It allows us to select some text then places quotation marks around the text before displaying the result to us—allowing us to edit it. (It's very basic but is part of a rather useful workflow I use to send messages to people quoting parts of articles that I have read.) 1. We have a Universal Action limited to text. So we select some text and run the 'Quote selected text' Universal Action. 2. We don't close Alfred's window (explained in this Simple Ideas post). 3. We'll use an Arg and Vars Utility to save the text as a variable and set opening and closing quotation marks. (See this Simple Ideas post for more on variables.) The selected text is passed in by Alfred as {query} so that's what we use when setting the selectedText variable. We're also setting opening and closing quotation mark variables—because we want to ensure we use smart quotation marks (we paste those in when creating the two variables). Note we're not passing out anything from this Arg and Vars Utility. 4. We use another Arg and Vars Utility to create a variable called quotedText—the contents of which are simply {var:openQuote}{var:selectedText}{var:closeQuote} (without any spaces between the variables of course). Again we pass nothing out of this Arg and Vars Utility. 5. Here we simply pass on (in the Arguments: box) {var:quotedText} (which we created in the previous step)—because we want to feed the text to Alfred's Text View… 6. Thus, here, in Alfred's Text View, is our quoted text. Note the prompts at the bottom of the window: ↩ to continue, ⌥↩ to edit the text and Esc to end the workflow. Rather more interestingly this is what we see when we double click on the Text View object: We've chosen Object Input as the source (the alternatives are Script and File) because we're using 5 above to input the text to Text View. For Behaviour: we select Selectable (rather than Editable or Markdown). That means we can select and copy text in the window but we can't edit it. Text Size: and Font: are left at their default settings. Footer Text: is important—because it's what the user sees at the bottom of the Text View window when viewing the text (and we've already seen the importance of feeding the user). Note that we have added the footer text that we want the user to see. We can press ⏎ simply to proceed and show the quoted text in large type. However, if we press ⌥⏎… 7. We keep Alfred's window open and move to… 8. A Text View window where we can edit the text: Note that in this Text View object for Behaviour: we have selected Editable rather than merely Selectable—and the only other things we have altered are the prompts at the bottom of the screen so that ⏎ allows us to edit the text and … 9. ⌥⏎ continues. (We use a modifier key for the alternative action.) 10. We save the output of the Text View object to a variable called theMessage so that… 11. In the Large Type Output we simply put {var:theMessage} in order to have the quoted (and possibly edited) text displayed. In conclusion If you want Alfred to serve your text on a plate (and optionally make it editable) the Text View object is the way to go. Of course, it's hugely more versatile than that (see what Vitor did with it in the ChatGPT/DALL-E workflow on the Alfred Gallery, for example). On a much more modest level it can be used for multi-line inputs to Alfred (you can see my Save 'ur note workflow if you want an example of that). But these posts are for "Simple Ideas” so we try to not to go too much over the top. 😀 Stephen The Simple Ideas posts
  10. Version 2.0 Simplified workflow by use of Alfred 5.5's Number Slider in the workflow configuration. (If you are using an older version of Alfred please use version 1.1 of the workflow.) Stephen
  11. Welcome to the forum. Alfred's clipboard history is stored at ~/Library/Application Support/Alfred/Databases/clipboard.alfdb, Stephen
  12. 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
  13. 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
  14. 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
  15. 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
×
×
  • Create New...