Jump to content

Stephen_C

Community Hero
  • Posts

    1,435
  • Joined

  • Last visited

  • Days Won

    72

Reputation Activity

  1. Like
    Stephen_C got a reaction from vitor in Your most used workflows   
    It would be helpful if you would provide some examples of the "many [outdated] scripts” because I'm sure the maintainer of the Gallery would wish to know.
     
    Perhaps that's a matter of opinion. What sort of things are you looking for that you're unable to find on the Gallery?
     
    (Just in passing, you did click on the link I provided and checked the Alfred Gallery, did you? It doesn't sound as if you're describing the same thing!)
     
    Stephen
  2. Like
    Stephen_C got a reaction from Alan He in Show Universal Actions for specific file type/extensions?   
    Take a look at the File Action Trigger.
     
    Stephen
  3. Like
    Stephen_C got a reaction from TomBenz in Your most used workflows   
    Have you looked at the Alfred Gallery?
     
    Stephen
  4. Thanks
    Stephen_C got a reaction from Daave in Open Hard-Coded URL Directly From Hotkey Combo?   
    Welcome to the forum.
     
    What you wish to do is very easy to achieve in Alfred. Start with a Hotkey Trigger and connect that to an Open URL Action containing the URL you wish to open.
     
    Stephen
  5. Like
    Stephen_C got a reaction from Alfred-Chris in Copy Image to clipboard   
    Try highlighting the relevant workflow, right clicking and choosing an option there.
     
    Edit: to make the easier you can sort the workflows by Gallery Updates.
     
    Stephen
  6. Like
    Stephen_C got a reaction from vitor in Automation Task - Menubar item in Front App not triggering "Tags..."   
    This is extremely quick and basic but indicates what can be done at the base level:

     
    Note:
    I don't use tags so set something up just to experiment. The Large Type Outputs are solely to show what has happened. Notifications would be rather more sophisticated. Stephen
  7. Like
    Stephen_C got a reaction from vitor in Automation Task - Menubar item in Front App not triggering "Tags..."   
    I think nobody can really help unless, instead of picking on isolated problems, you tell us exactly what you're trying to achieve in general terms. Just describe it in plain English without reference to Alfred's functionality and maybe someone will be able to come up with an idea to assist.
     
    Stephen
  8. Like
    Stephen_C got a reaction from vitor in Automation Task - Menubar item in Front App not triggering "Tags..."   
    Sorry badly phrased…what I meant was approaching tags from a different angle and exploring what Automation Tasks can do with them. I didn't mean searching for tags, as such!
     
    Stephen
  9. Like
    Stephen_C got a reaction from Alfred-Chris in Copy Image to clipboard   
    Sorry, I wasn't clear enough. To do what I outlined you must right click on the name of the workflow in Alfred's list of workflows.
     
    Stephen
  10. Like
    Stephen_C reacted to vitor in Automation Task "Strip Last Line" Malfunctions   
    You are both correct and the behaviour is both consistent and easy to explain once you learn it. I read the original post last night but it was already pretty late so I decided it was best to (literally) sleep on it rather than send a tired reply.

    Essentially what’s happening is that newlines are meaningful and Unix¹ tools act under that assumption. So when you have 1\n2\n3\n4, technically the termination is incorrect and should be 4\n. Like so many other things in computing, there’s no outright right or wrong answer, it depends. For instance, the Python example above always eats the final newline, whether it was originally there or not. If you used that output to write to a file, you’d have an invalid² text file. On the other hand in JavaScript you have to split on \n, so it will give you an empty last item depending on if the last newline is there or not. And in Ruby… Ah, you get the picture.

    All that said, other Automation Tasks which could have different results depending on the trailing newlines (such as Text Metrics) already correct for these cases to conform to expectations³ so this one will as well. Note that the result will always output a newline at the end, as per the more “correct” Unix interpretation (you can always trim that with another object if absolutely necessary). I have working code for it since early this morning, but since it’s not urgent (as you have a workaround) I’ll think on it a bit more in case I forgot something.

    Thank you for reporting.

    ¹ The type of operating system that macOS is.

    ² Again, in the technical sense. macOS would know how to read it anyway but some tools like wc would give different results.

    ³ I understand it’s frustrating trying to debug something which depends on invisible characters.
  11. Like
    Stephen_C got a reaction from noisyneil in Recent Documents / Apps ?   
    You know that there's a Universal Action for recently opened files, don't you? If you search in Alfred for the name of an app then use your Universal Action hotkey (⌘/ by default) you should find Recent Documents… in the list.
     
    Stephen
  12. Haha
    Stephen_C got a reaction from spongeblink in Automation Task "Strip Last Line" Malfunctions   
    @spongeblink we may have the key in this:
     
     
    My file did have an empty 6th line. When it does not I can reproduce your result.
     
    Edit: Yes, same version of Automation Tasks.
     
    Stephen
  13. Like
    Stephen_C got a reaction from paulmoons in Custom Search Parameters After Query not Passed on to Search Engine   
    Let's see what others add to this in due course.
     
    Edit: For others wondering where all this started (at least for me) there's an interesting Ars Technica article on the subject.
     
    Stephen
  14. Like
    Stephen_C got a reaction from vitor in Aerospace Tiling Window Manager Extension for Alfred   
    Speaking purely personally, I am significantly put off by this in the Aerospace ReadMe:
    No doubt that's fine for some but…not for me, thanks. 😀
     
    Edit: Not seeking to start a debate about this but just thought others, too, might wish to be aware.
     
    Stephen
  15. Like
    Stephen_C reacted to vitor in Clipboard history should favor items that start with search term   
    @Stephen_C Great catch. I didn’t even remember I made that.
  16. Like
    Stephen_C got a reaction from vitor in Clipboard history should favor items that start with search term   
    Welcome to the forum.
     
    A quick search revealed this post which you may find helpful.
     
    Stephen
  17. Like
    Stephen_C got a reaction from jwm in Pre-defined list of Apps to open in a Script Filter?   
    I think all you need is a List Filter Input linked to a Launch Apps & Files Action.
     
    Stephen
  18. Like
    Stephen_C got a reaction from jwm in Pre-defined list of Apps to open in a Script Filter?   
    Yes—set it up "with space” and "argument optional”.
     
    As to icons, you may be able to copy them by doing ⌘I (for "information”) on the app in Finder and copying them from there. It has worked for me before. (There are doubtless other more complex ways of obtaining app icons.)
     
    Stephen
  19. Like
    Stephen_C got a reaction from DrSirius in Automation Tasks - Screenshots issue   
    Sorry I'm out of ideas just at the moment but don't despair someone will come along with some suggestions.
     
    Stephen
  20. Like
    Stephen_C got a reaction from rob213 in frustrated: just want to add a universal file action to rename the file (add date/time suffix), copy to one folder and move to another   
    Basically, save the (selected) filename to a variable (e.g., filename), create a new variable (e.g., newFilename) consisting of {var:filename} and whatever you want to add to it.
     
    Stephen
  21. Like
    Stephen_C got a reaction from ebell in Multiple versions of same workflow   
    I suggest you try moving your Alfred preferences from iCloud to a local folder on your Mac and, for good measure, rebooting, to see if that resolves the issue. I still have suspicions about your preferences not being fully available offline.
     
    Stephen
  22. Like
    Stephen_C got a reaction from Textdriven in Simple Ideas: sulky workflows—bug catching   
    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
  23. Thanks
    Stephen_C got a reaction from Textdriven in Simple Ideas: back to the starter (things I wish I knew…)   
    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
  24. Thanks
    Stephen_C got a reaction from Textdriven in Simple ideas: opening a frequently used folder   
    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
  25. Like
    Stephen_C reacted to Vero in Help with snippet dates!   
    @thelitigator A minor adjustment to @Stephen_C's suggestion will be to make the year element of the date lowercase yy instead of uppercase, as the lower case is what we think of as the year, whereas the YY alternative refers to the "week of year", meaning you may get strange results in the first week of the year.
     
    As such, your placeholder would use yy-MM-dd for year, month and date in the format you had in mind
     
    Cheers,
    Vero
×
×
  • Create New...