Jump to content

vitor

Staff
  • Posts

    8,415
  • Joined

  • Last visited

  • Days Won

    695

Posts posted by vitor

  1. 7 hours ago, AuthorsAssembler said:

    I wondered if Alfred can handle


    You can do it from Alfred, yes, but it will require a bit of coding. We can help you with that.

     

    7 hours ago, AuthorsAssembler said:

    among other things


    If you’re not comfortable with coding, you’ll have to share every step in as much detail as possible for us to be able to help.

     

    7 hours ago, AuthorsAssembler said:

    An alias (shortcut) of a folder


    For example, the exact source of that directory and where everything is going to be saved.

     

    7 hours ago, AuthorsAssembler said:

    A Finder Window pathname that's hyperlinked.


    I don’t know what that is. Can you describe it another way and/or with images?

     

    7 hours ago, AuthorsAssembler said:

    and the latest Alfred.


    Never say you’re on the latest; always specify the exact version. We don’t know if “latest” means the latest beta or stable or if you think you’re up to date but are mistaken. Furthermore, people who bump into your post in the future won’t know if it applies to them. That’s more relevant for debugging, though, it doesn’t matter as much in this case.

  2. From the documentation:

     

    Quote

    We recommend Dropbox as the most reliable way to sync your preferences. iCloud and Google Drive are not recommended.


    In theory it should work because you’re telling Google Drive to keep that directory locally. In practice, Google Drive File Stream is known to be problematic on macOS.

  3. 8 hours ago, Chris Messina said:

    I expected that /usr/bin/python would be python3, but it turns out that (on my system) it's Python 2.7.18. 


    That’s not an oddity of your system, it’s expected. It isn’t worth going into the Python 2/3 kerfuffle here but don’t expect that to ever be updated on macOS. Apple is actively removing scripting languages and no longer updates them.

     

    8 hours ago, Chris Messina said:

    and selecting python from this list causes errors in the console.


    Because you’re using Python3 features. macOS has never shipped Python3, though it installs it with the developer tools.

     

    9 hours ago, Chris Messina said:

    Is it possible to tell Alfred to use python3 to run the script?


    Yes, but you can’t paste the script into the box. There are a few ways to do it; one is to set it as /bin/bash then /full/path/to/python3 /path/to/your/script.

     

    Note that using Python3 currently makes your Workflow harder to share, which you may or not care about. There are plenty of Python3 Workflows shared on the forum (e.g. by @Acidham) so look at those for ideas.

  4. 58 minutes ago, Gearbox Sorrows said:

    I hope that makes it a little bit clearer.

     

    It does!

     

    59 minutes ago, Gearbox Sorrows said:

    I've not yet tried defining the elements as their own variables. Didn't know that was possible too.

     

    See Script Filter JSON Format and search for variables. You make them at the top level or per item.

     

    1 hour ago, Gearbox Sorrows said:

    I'm still interested though what I'm doing wrong with the splitting.

     

    It’s what I deduced above:

     

    2 hours ago, vitor said:

    Are you trying to split on commas? Because there are no commas in your output. And you’re sending two arguments, not one.

     

    "arg": ["Offensichtlichen Effekt","abcdefg"] means there are two arguments: the first is Offensichtlichen Effekt and the second abcdefg. None of them has a comma in it, so there is no splitting. Try instead "arg": "Offensichtlichen Effekt,abcdefg" (one argument, with a comma) or add a comma anywhere inside the quotes for one of the arguments and it will work.

  5. 37 minutes ago, Gearbox Sorrows said:

    Somehow the quotation marks for the second element are dropped. Not sure why that is.


    They aren’t dropped; they aren’t there to begin with. The other shows it because there is a space and it makes clear it’s a single entry. That isn’t relevant, thought.

     

    39 minutes ago, Gearbox Sorrows said:

    Anybody have a clue what I'm doing wrong?


    We can’t say for sure unless you share (a simplified version of) your Workflow, and ideally explain what you’re trying to accomplish. Debugging is already hard with access to code, and you’re asking us to do it from an incomplete description. We don’t even know what’s the character you’re splitting on. Are you trying to split on commas? Because there are no commas in your output. And you’re sending two arguments, not one.

     

    Why are you using the splitting utility? If you’re outputting from a Script Filter anyway, define the variables there. Or use the arguments directly.

     

    Again, it’s impossible to say the best course of action (but it’s likely not splitting the argument) without context.

  6. I like that idea. Here’s a Workflow for it. Consider it a beta but it’s mostly done. It’s missing a README and an icon. The autoupdate is already set up, so when it’s released you’ll get that version.


    Run asdic to list the dictionaries, press ↵ to open it. The first run will take a few seconds to find the dictionaries, but subsequent runs will be instant.

  7. 12 minutes ago, deanishe said:

    I’d be tempted to rip out all the code that puts results in environment variables.

     

    Agreed that in order to juice a bit more of performance it started to toe into complexity. Also agreed that is in large part due to the environment variables, because it means looking down and up to understand how reruns change. But it does make a difference, mostly with slow connections.

     

    14 minutes ago, deanishe said:

    I don’t understand what the Seed is for.

     

    If you’re in a Script Filter, highlight any item other than the first, and the results change, you’ll be pulled back to the first item on the list. This happens even if the item you had highlighted is still present. Unless you add a UID to it, in which case your item will keep being highlighted.

     

    But these results cannot have fixed UIDs because that affects the order and one difference from the PHP versions is that the first result has to always be the exact typed query.

     

    By adding a seed, we make UIDs which are unique to that run. It preserves your position when the data changes while allowing for a fixed first result.

  8. Just now, Habeeb said:

    Didn't meant to insult (…) Apologies :(

     

    Accepted. Thank you.

     

    1 minute ago, Habeeb said:

    since he didn't mention anything about debounce or throttle in his answer

     

    Because if you looked at the code and had specific changes in mind, it seemed more productive to encourage you to test and submit those for consideration.


    When I said the Workflow was “juiced for speed without compromising usability”, it does mean I tried and tested different approaches. Due to the way Script Filters behave, at one point a choice had to be made between optimising for the typed query or the autocomplete results. The former won. Because you’re typing so fast you may not see autocomplete results, but the alternative meant your query might be cut off when passing it downstream. In other words, there’s always a tradeoff and this one was deemed more acceptable.


    Keep in mind that simplicity is also key. The Workflow ships with Alfred so there’s an upper bound to the complexity of a solution.

  9. Update.

     

    Renamed this Workflow to RecentlyAdded. Removed the cache option, but in return the code is faster and smaller and it supports multiple directories at once.

     

    Also removed the hardcoded ⌥↵ for Reveal in Finder. Anyone chan pick their preferred shortcut in Alfred Preferences → Advanced.


    To update, download the latest version or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

  10. @brian_seidman Nice analysis, you are correct. To circumvent NSTask decomposition I use the clipboard as a temporary placeholder of information but do not pollute the history and restore the clipboard to what it was when the Workflow ends. I hadn’t consider the shortcut itself might change the clipboard and that in that case the Workflow shouldn’t restore it.

     

    Just released 2022.2 which fixes it.

×
×
  • Create New...