Jump to content

sirris

Member
  • Posts

    6
  • Joined

  • Last visited

sirris's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. Thanks both. This worked great, after I copied the .mjs and node_modules folder into the Workflow folder. I could have also referenced an external file location just as easily, i.e., ~/Scripts/covert-epoch.mjs.
  2. Thanks @giovanni! I'm at a loss at how to do this, and still trigger my script with a hotkey:
  3. Thanks, makes sense. Any advice on how to do so? I can't seem to add a PATH statement to my .mjs script (it's in JavaScript). I'm attempting to following this instruction: Method 3: Set PATH before calling your tools. I attempted putting it before the #! line-- it didn't work. Nor did creating a bash shell script (with the PATH statement) to run prior to my .mjs script.
  4. @vitor, thank you! That makes perfect sense. For anyone else following, here's the line I added at top of my .mjs external script file: #!/opt/homebrew/bin/node /opt/homebrew/bin/zx For those less familiar, use 'which node' and 'which zx' at the terminal to discover the appropriate path for your binaries.
  5. Thanks much @vitor! Using External Script. Here's what I get with two attempts: #!/usr/bin/env zx console.log('Testing 123'); Gives error: [19:30:10.675] Logging Started... [19:30:12.617] ScrScriptipt[Hotkey] Processing complete [19:30:12.619] Script[Hotkey] Passing output '' to Run Script [19:30:12.632] ERROR: Script[Run Script] env: zx: No such file or directory [19:30:12.633] Script[Run Script] Processing complete [19:30:12.633] Script[Run Script] Passing output '' to Post Notification ... #!/opt/homebrew/bin/zx console.log('Testing 123'); Gives nothing: [19:33:06.696] Script[Hotkey] Processing complete [19:33:06.701] Script[Hotkey] Passing output '' to Run Script Both paths resolve at shell to zx. And I can run the script in terminal with: "./script.mjs". I use zsh as my default shell.
  6. Google released an excellent new shell-scripting tool called zx that allows you to write shell scripts in JavaScript/JS with a bunch of helpful modules: https://github.com/google/zx -- i.e. things like Fetch built in. I've been unsuccessful at getting a zx script (.mjs) to work as an external script in an Alfred workflow. I've chmod +x, ensured paths are correct, and it still won't execute. I've even tried using a bash script to initiate the zx script: #!/bin/sh /opt/homebrew/bin/zx /Users/username/myscript.mjs Any advice? I'd love to be able to use this versatile new tool with Alfred!
×
×
  • Create New...