rknightuk Posted December 15, 2022 Share Posted December 15, 2022 Author: Me Github: https://github.com/rknightuk/alfred-workflows/tree/main/workflows/findmoji Dependencies: none Icon: https://github.com/rknightuk/alfred-workflows/raw/main/workflows/findmoji/src/icon.png Screenshot: https://github.com/rknightuk/alfred-workflows/raw/main/workflows/findmoji/src/screenshot.png Link to comment Share on other sites More sharing options...
vitor Posted December 28, 2022 Share Posted December 28, 2022 This doesn’t affect inclusion, but the Script Filter can be made faster / with fewer steps. You’re using bash to call osascript to call script.js which spits out some JSON. First way you could simplify that would be to use External Script instead of /bin/bash and call script.js directly, with the proper shebang (#!/usr/bin/osascript -l JavaScript). But the way simpler method is to leave it as /bin/bash and just do a cat on a JSON file! In other words, you’re calling osascript with a huge object which the script then converts to a string (the JSON) and outputs it to Alfred, that’s repeated unnecessary computation. By doing it once and saving the JSON file with the workflow, you can simply tell the Script Filter to output the file itself. Less code, fewer resources needed, and faster. Link to comment Share on other sites More sharing options...
rknightuk Posted January 2 Author Share Posted January 2 You're absolutely right and I'm kicking myself now for making it so much more difficult that it needed to be. Both this and HTTP codes have been updated to 1.0.1 used `cat` on the JSON instead of mapping it for no reason. Thanks Vitor, appreciate your help. vitor 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now