Jump to content

vitor

Staff
  • Posts

    8,587
  • Joined

  • Last visited

  • Days Won

    716

Posts posted by vitor

  1. This is simple enough and looks quite ready to go in the Gallery, but I have a few suggestions:

    • You don’t need the Run Script, you can and should instead use the Run Shortcut automation. That would make it use no code and be a good candidate for the “Good for Learning” category.
    • Would be useful to add a Hotkey Trigger too. I can imagine someone using e.g. ⌘⇧6 to take the screenshot and get the text. By the way: nice use of the Automation Task.

  2. This can be done by leveraging the rerun key in the Script Filter JSON. If you know your script will be slow, you can have it run multiple times and return more data as it’s available.


    This thread is a decade old and Alfred is constantly evolving, so for something this old it’s best to instead ask the question anew, expanding with your specific set of requirements as the solution you need may even be better served by a different approach.

  3. You don’t need the export PATHAlfred already includes those. You also shouldn’t need those variable assignments, they don’t look like they’re doing anything. In short, the last line should be enough for everything.


    I’m wondering why you split the flow of objects into a new line halfway, as opposed to just continuing to the right. Doesn’t make a difference, I’m just curious if it was to make the screenshot easier to understand see or if there’s another reason.

  4. Performance doesn’t just mean speed. You cannot fairly compare the resource usage of apps which are continually running in the background and gathering information to a single binary that must launch, execute, and exit in a fraction of a second. It’s different tradeoffs (like almost everything in computing) and Window Switcher is designed to be fast and consume effectively nothing, especially when you’re not using it.

     

    In addition, you’re focusing on one third of the given reasons and not the right one. That post does not say hidden windows specifically cause performance issues. Every one of the tools we’re talking about has a different interface and objectives.

     

    It’s worth noting the code is open-source, which allows anyone to pick it up and tweak it to their needs. There are also other window changing workflows which may behave in other ways. Different people have different preferences and value different things. There is a strong core of users who like the workflow exactly as it is, and it’s important to not ignore that.

  5. Are you using the official Dropbox app on both Macs? That’s the exact kind of issue that would happen by using a third-party client like Maestral, for example. Something on either of your Macs is either evicting files from local storage (as per explanations above) or removing the executable bit of scripts (which can also be caused by bad syncing). Both of those also explain why reinstalling a workflow would fix it. Moving your preferences to a non-synced folder, as per above, should do it too. Think back to when it started and what changes you made to your Mac then, and you may find the cause.

  6. Sometimes when working in a Terminal you may want to interact with files via a workflow. Alfred supports AppleScript, so an External Trigger is the perfect solution for something you use often. But what if you want quick access to all available Universal Actions? That’s easy too. Add the following to your ~/.zshrc, and you’ll be able to trigger the Universal Actions window from a Terminal by executing ua followed by the desired file paths.

     

    function ua {
      # Verify all paths are valid
      for file_path in "${@}"
      do
        if [[ ! -e "${file_path}" ]]
        then
          echo "Path does not exist: ${file_path}" >&2
          return 1
        fi
      done
    
      # Expand arguments into full paths
      local -r absolute_paths=("${(@f)$(realpath "${@}")}")
    
      # Open Universal Actions
      /usr/bin/osascript -l JavaScript -e 'function run(argv) { Application("com.runningwithcrayons.Alfred").action(argv) }' "${absolute_paths[@]}"
    }

     

    A couple of notes:

    • The function is Zsh-specific. It is possible to do the same in Bash, but the focus above is on macOS’ default.
    • It requires macOS Ventura or above. Again, it is possible to make it work on older versions, but it would be more verbose.
    • Most of the code is checking if paths exist. That’s not strictly necessary and you can make it significantly shorter by only including the local -r and /usr/bin/osascript lines.

  7. I can’t say (because I can’t know) if a workflow which isn’t built yet will be a fit for the Gallery. It is doable to evaluate a workflow that exists but much harder to comment on an idea, even if it’s from someone who no doubt has the skills to execute.


    A good rule of thumb is to not build workflows with the explicit goal of being featured in the Gallery. The process is “pull” (creators are contacted for submissions of specific existing workflows) rather than “push” (creators submitting anything unprompted). Even some of my own workflows won’t ever be added and will continue to only exist in the forum and GitHub. That is OK. The goal of the Gallery is not to contain every possible workflow but have some degree of curation.


    Regarding the name (and default keyword), it is possible the 1Password folks could have a problem with it. I’m not a lawyer (nor have I played one on TV), but it’s my understanding that in certain jurisdictions you have to defend your trademarks to not lose them. Regardless, since it does not in fact interact with any 1Password product, as it stands it would no doubt generate confusion and support requests.


    For reference, the 1Password workflow in the Gallery was created with the full knowledge of the 1Password team, including permission to use the name and icon.

     

    Hope that clarifies it. It’s a couple of busy weeks so it may take me a bit longer to reply, but I’m aiming to check your other post soon too. There are already curious parties in this thread, so I’ll be sure to keep an eye out.

  8. It should also work if you simply launch the app as normal from Alfred, by opening it and typing its name. Using word should work for your example, unless Microsoft is doing something funky (it worked fine on every app I tried just now). Or use @Stephen_C’s suggestion but with an od Keyword Input instead of a Hotkey.

     

    As a fun aside, on macOS you can also press fn and a to select and navigate the Dock with the arrow keys. Not as convenient or fast as doing it from Alfred, but neat trick nonetheless. There are a new other fn + single letter shortcuts available (e.g. fn + n for the Notification Centre) if you feel like experimenting.

  9. Quick note: If you want the full path, you don’t even need the Automation Task, you can connect the Universal Action directly to the Copy to Clipboard.


    Considering your last post, you might want a File Filter instead of a Universal Action.


    I highly recommend you go through the interactive guide, as linked above. It’ll teach you the basics and help you to figure out how to figure out these details.

  10. A more efficient way of handling this would be to, instead of relying on file search to open the command file, making a workflow (connect a Keyword Input to an Open File Action, or even better a Run Script Action) and adding the icon to the workflow or Keyword.


    Consider that if Alfred were to read the custom icon for every file of every file type, that could have a noticeable impact on performance (even unrelated searches) since there’d be an extra operation that would need to happen before displaying each result.

  11. Should also be worth considering joining both workflows together for the next version, so people only have to install one. Or (I just thought of this while writing the previous sentence) even having a Script Filter that both shows the battery and allows for connecting and disconnecting (you shouldn’t be able to know battery levels anyway when AirPods are disconnected, I’d guess).


    If you have an alternative icon, that would be helpful to further differentiate from the other AirPods workflow too. It surprised me a bit when I downloaded the Connector yesterday, as the icon in the notification was different from the one in the workflow.

  12. This is vey much untested (I have neither Pro Tools nor a keyboard with numpad), but what I was suggesting was something like:

     

    const systemEvents = Application("System Events")
    const keycodeNumpadMap = {
      "0": 82,
      "1": 83,
      "2": 84,
      "3": 85,
      "4": 86,
      "5": 87,
      "6": 88,
      "7": 89,
      "8": 91,
      "9": 92,
      ".": 65
    }
    
    function run(argv) {
      argv[0].split("").forEach(character => {
        systemEvents.keyCode(keycodeNumpadMap[character])
      })
    
      systemEvents.keyCode(76)
    }

     

    This is using /usr/bin/osascript (JavaScript).

×
×
  • Create New...