Jump to content

vitor

Staff
  • Posts

    8,525
  • Joined

  • Last visited

  • Days Won

    712

Posts posted by vitor

  1. Welcome @damagekko,

     

    The error means that particular action requires the Objective-C bridge. There’s a very small subset of Python 2 Workflows who do. At the moment it’s not viable to support those because the required Python packages fail (for me?) to build under Apple Silicon. If you’re on Intel, you may be able to do so ("${HOME}/.pyenv/versions/2.7.18/bin/python2.7" -m pip install PACKAGE_NAME) but the build failure makes it impossible for me to support it.

  2. 17 hours ago, John H said:

    Making an assumption you speak Portuguese

     

    I do, yes, though that expression is Brazilian and I’m Portuguese. We would say “És o maior!” (literally “you’re the biggest”).

     

    17 hours ago, John H said:

    it's chugging along now.

     

    Great! The clue was that ls worked for you in a Terminal but the diagnostics wasn’t finding any paths. This is a good example of why it’s useful to always send it.

  3. Welcome @John H,

     

    4 minutes ago, John H said:

    What's pasted in the clipboard doesn't really provide any information - the cache file is empty.

     

    It doesn’t matter that the cache file is empty, the diagnostics provides information to try to figure out why that is. You need to provide all requested information for me to be able to help.

     

    In addition, I’ll need the output of ls /Volumes/GoogleDrive (in a terminal).

  4. 6 hours ago, rlocker said:

    or how one would develop one for copying a OneDrive sharing URL to my clipboard?

     

    That depends mostly on Microsoft. Do they provide a way for you to get a OneDrive share link programatically, via some API or command-line tool? From a quick search it seems they may not, so it’s not possible for other apps to automate the process either. If you find a tool which makes it possible, we can help you integrate it in an Alfred Workflow.

  5. Welcome @CJJJJ,

     

    20 hours ago, CJJJJ said:

    I can't find files on my laptop when using Alfred.

     

    See Troubleshooting File Indexing Issues for possible causes and fixes.

     

    20 hours ago, CJJJJ said:

    I'm using Google Drive for file storage

     

    In that case, the situation changes. Are those mirrored files found by Spotlight? Because if they’re not, Alfred can’t see them as well as it relies on the same index. If you search online, you’ll find there is a long-standing problem of Google Drive not being indexed on macOS. That is why there is a Workflow specifically for it.

  6. On 3/21/2022 at 11:33 PM, Larrikin said:

    I don't know how to remove python2 later

     

    In a terminal:

     

    export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
    eval "$(brew shellenv)"
    osascript -e "tell application \"Finder\" to delete (POSIX file \"${HOME}/.pyenv\")"
    osascript -e "tell application \"Finder\" to delete (POSIX file \"${HOMEBREW_PREFIX}/bin/python\")"

     

  7. When configuring a Run Script or Script Filter, Alfred provides a Language dropdown listing the runtimes which have historically been included with macOS. But what if you want to run a script from another language which you have installed on your system? Be it Node.js, Lua, or something else, it’s dead-simple to call them. Either:

    • Save your script with a proper shebang (examples: #!/usr/bin/env node; #!/usr/bin/env lua) and use External Script as the Language, pointing to your script.
    • Use /bin/zsh (or /bin/bash) as the Language and tell the runtime to call your script (examples: node MY_SCRIPT.js; lua MY_SCRIPT.lua).

    The first executes (marginally) faster but the second allows you to send preset arguments to your script. They work as they are assuming the languages were installed with Homebrew, as Alfred includes its directories in its PATH.

  8. 1 hour ago, giovanni said:

    but the JSON content is served to Alfred after the delay.

     

    It’s served when the script ends, so the position of the delay does not make a difference. That is why in your World Cheater you can echo (in your case, cat a heredoc) sequentially and it works.

     

    1 hour ago, giovanni said:

    How do I serve the 2 JSON strings sequentially?

     

    You can’t serve two JSONs, only one. The reason you’re getting an error is that while you are spitting out two valid JSONs individually, what Alfred is seeing is the concatenated text of those. Two valid JSONs stuck together are not a valid JSON string.

     

    You can either add all your data at once (which I recommend; fewer moving parts) or you create a variable to hold your data as you modify it and print it at the end (which I do in the example, due to the timeout):

     

    #!/usr/bin/env python3
    
    import time
    import json
    
    result = []
    
    result.append({
        "title": "Testing!",
        "subtitle": "testing script order of execution"
    })
    
    time.sleep (5)
    
    result.append({
        "title": "Testing again!",
        "subtitle": "testing script execution"
    })
    
    print (json.dumps({ "items": result }))

     

    Or perhaps what you’re thinking is:

     

    #!/usr/bin/env python3
    
    import time
    import json
    
    result = [{
        "title": "Testing!",
        "subtitle": "testing script order of execution"
    }]
    
    time.sleep (5)
    
    result = [{
        "title": "Testing again!",
        "subtitle": "testing script execution"
    }]
    
    print (json.dumps({ "items": result }))

     

    But that will only show the second one, which is expected.

     

    If what you’re looking for is to show one JSON then wait and show a different one, you don’t sleep in your code but tell Alfred (via the JSON) to rerun it after a number of seconds. You may also need variables to hold some data (e.g. so the script knows if this is the first run or a subsequent one). The Getting Started → Advanced Script Filters Workflow which comes bundled with Alfred has examples of both.

×
×
  • Create New...