Jump to content

vitor

Staff
  • Posts

    8,528
  • Joined

  • Last visited

  • Days Won

    713

Posts posted by vitor

  1. 1 hour ago, topepo said:

    I’d like to write some code that creates a plist or some other textual format that Alfred could consume to define the workflows.

     

    Then you’re in luck! Alfred Workflow’s have an info.plist at the root of their directories—replicate the format and you programatically create the Workflow. A few developers do that to add and remove objects in response to user configuration.

  2. When a Workflow doesn’t run, check the debugger as it will give you important clues.


    From a cursory glance, issues are that you’re missing a shebang and that you’re calling an external tool (pdftk) without using its full path (Understanding the scripting environment goes into more detail). Fixes are:

    • Make the first line of your script #!/bin/zsh
    • Use the full path to pdftk. Run which pdftk in a Terminal to find out what it is.

  3. 2 minutes ago, podious said:

    Would u suggest me a similar project so I can modify it.

     

    Alfred’s documentation is pretty good. It has plenty of examples and Workflows to get you started. But you’ll have to write (or find) the code for it. Search for browser automation with AppleScript. You’ll have to recreate every search you want, then on every call have your code loop through every tab of every window and act accordingly.


    An alternative would be a Workflow to close duplicate browser tabs. I had that thought before and may yet build it, but no promises or ETA.


    Consider first opening a feature request with the makers of the browser you use for them to include that behaviour.

     

    3 minutes ago, podious said:

    Concerning the browser, I can pass to safari or chrome if it works.

     

    As I mentioned, if you use Safari it already behaves like you want.

  4. 3 hours ago, UncommentedC said:

    Added support for macOS ≥ 12.3

     

    It won’t work out-of-the box as it is. The session start Script Filter still depends on Python 2, and in the other scripts you’re using /usr/local/bin/python3 as the shebang, which won’t work for people on Apple Silicon. A better shebang would be /usr/bin/python3, which if not installed will prompt a GUI (from macOS) to do so in two clicks. Do note that’s an older Python version, but at least it’s v3.

  5. When you tell Alfred to open a URL, it essentially passes the message along to macOS who then handles it. After macOS sends it to your default browser, it’s up to the browser itself. If you want a different behaviour, you’ll have to create a Workflow to automate the browser in question. The way to do it depends on which browser it is. If it’s Firefox, forget it. Safari, on the other hand, works how you want out of the box.

  6. 5 minutes ago, TomekB said:

    Here's Python3 version for those who don't want to download Python2 for macOS 12.3

     

    I’ll add it to the table as an alternative. If it’s merged, I’ll update it accordingly.

     

    Do note the default branch in your repository is develop and that one has the old Workflow. Anyone visiting the main page of the repo won’t be encountering the updated version. Changing the default branch is simple.

  7. 16 hours ago, giovanni said:

    this is currently a reasonable solution.

     

    Given the constraints, yes. You can improve it by using ?workflow myString instead of ?myString. That way you guarantee to only match against Workflow names, not their objects.


    But why are you running AppleScript code through Python, is it part of a larger script? If not, run it directly because it will be faster, more readable, and more resilient.

×
×
  • Create New...