Buchholdt Posted November 25, 2021 Share Posted November 25, 2021 Hi guys, This seems like at great plugin. I'm having a problem setting it up, as I can't figure out how to insert my Tinypng api. When I try to do it, I end up with a google search. Can you give me some pointers on how to insert the api? Best regards, Link to comment
deanishe Posted November 25, 2021 Share Posted November 25, 2021 2 hours ago, Buchholdt said: When I try to do it, I end up with a google search. You're seeing Alfred's fallback results. That's what Alfred shows if a workflow returns no results. Check the workflow debugger for a proper error message. Link to comment
Buchholdt Posted November 26, 2021 Share Posted November 26, 2021 Cool deanishe, I did not know that feature. I get the following error: [09:26:37.298] Logging Started... [09:26:46.688] TinyPNG[Script Filter] Queuing argument '' [09:26:46.697] TinyPNG[Script Filter] Script with argv '(null)' finished [09:26:46.699] ERROR: TinyPNG[Script Filter] Code 127: /bin/bash: : command not found Does this mean anything to you? Link to comment
deanishe Posted November 26, 2021 Share Posted November 26, 2021 1 hour ago, Buchholdt said: Does this mean anything to you? Looking at the error message and the code, you’ve forgotten to set the pythonDir variable. Looks like a bug, tbh. From the workflow's description, setting the variable is supposed to be optional, but it's absolutely required by the code. If it were me, I would change the tinypng and tinypng_api Script Filters from: "$pythonDir" tiny_key_options.py {query} to: export PATH=/opt/homebrew/bin:/usr/local/bin:$PATH python3 tiny_key_options.py {query} Link to comment
Buchholdt Posted November 26, 2021 Share Posted November 26, 2021 Thanks again, it's really appreciated. I have done the changes and its like I'm almost there, once I paste the API I get the following: [14:03:43.668] TinyPNG[Script Filter] Queuing argument '' [14:03:43.725] TinyPNG[Script Filter] Script with argv '(null)' finished [14:03:43.727] TinyPNG[Script Filter] {"items": [{"title": "Set API key to ...", "subtitle": "Set API key to ...", "valid": false}, {"title": "Get a new API key", "subtitle": "Open https://tinypng.com/developers to get a new API key", "arg": "WEBSITE", "valid": true}]} [14:03:45.479] TinyPNG[Script Filter] Queuing argument 'GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ' [14:03:45.535] TinyPNG[Script Filter] Script with argv '(null)' finished [14:03:45.538] TinyPNG[Script Filter] {"items": [{"title": "Set API key to \"GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ\"", "subtitle": "Set API key to \"GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ\"", "arg": "GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ", "valid": true}]} [14:03:46.638] TinyPNG[Script Filter] Processing complete [14:03:46.640] TinyPNG[Script Filter] Passing output 'GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ' to Conditional [14:03:46.641] TinyPNG[Conditional] Processing complete [14:03:46.641] TinyPNG[Conditional] Passing output 'GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ' to Run Script [14:03:46.642] TinyPNG[Conditional] Passing output 'GF4qGlzLMPr0fnV1mF9hDfxq9GH8f9rZ' to Post Notification [14:03:46.652] ERROR: TinyPNG[Run Script] /bin/bash: : command not found [14:03:46.654] TinyPNG[Run Script] Processing complete [14:03:46.655] TinyPNG[Run Script] Passing output '' to Conditional [14:03:46.655] TinyPNG[Conditional] Processing complete [14:03:46.656] TinyPNG[Conditional] Passing output '' to Run Script [14:03:46.656] TinyPNG[Conditional] Passing output '' to Post Notification So it's like the API has not been accepted. Link to comment
deanishe Posted November 26, 2021 Share Posted November 26, 2021 1 hour ago, Buchholdt said: [14:03:46.652] ERROR: TinyPNG[Run Script] /bin/bash: : command not found There are two scripts that need editing. Remove your API key from your post. Link to comment
Buchholdt Posted November 27, 2021 Share Posted November 27, 2021 On 11/26/2021 at 3:25 PM, deanishe said: There are two scripts that need editing. Remove your API key from your post. Thanks again. If you have the time, can you clarify a bit more about the 2 scrips I need to edit? Also, I did change som characters in the API, so no issue there. Also, just another question. I'm Used to use Alfred some years ago, before having to with to a PC (work), and now I'm very happy to be back again. I don't remember that I needed so much knowledge to activate a Alfred app. Has the apps become much more complex, or does this seem to be 1/100 times were you need to do a bit more work? Link to comment
deanishe Posted November 27, 2021 Share Posted November 27, 2021 3 hours ago, Buchholdt said: If you have the time, can you clarify a bit more about the 2 scrips I need to edit? It’s the same error message as before, which means that $pythonDir still isn’t set. Presumably, this means you only fixed one of the tinypng and tinypng_api scripts, and the error is coming from the other one. 3 hours ago, Buchholdt said: Has the apps become much more complex It's just the way the workflow is built. @shmulvad chose to use a language that isn't installed by default, so you're going to need to install that to use this particular workflow. TinyPNG requires an API key, so the workflow requires some unavoidable configuration, too. The former (needing to install a language) is going to become very common in the future, however, as Apple have been steadily removing non-Apple languages from macOS over the past few years. Link to comment
Buchholdt Posted November 28, 2021 Share Posted November 28, 2021 I found that I could also change the "$pythonDir" in the file "/bin"bash" files: But it did not quite get me there. Looking more into the files, I wounder if I kan insert the API directly into the "/usr/bin/osascript" as either the "API_KEY" or "{query}": set bundleID to (system attribute "alfred_workflow_bundleid") tell application id "com.runningwithcrayons.Alfred" set configuration "API_KEY" to value "{query}" in workflow bundleID end tell Can you tell if this code is like fx. javascript? As you mention, there will probably be more need for some basic code knowledge in the future. I have for some time thought about learning a language, to get a better understanding, and it seems like Javascript is quite popular, and if I can use it here in Alfred, it might be the language for me to try out. Link to comment
deanishe Posted November 28, 2021 Share Posted November 28, 2021 (edited) 46 minutes ago, Buchholdt said: Looking more into the files, I wounder if I kan insert the API directly into the "/usr/bin/osascript" as either the "API_KEY" or "{query}" Not worth the hassle. The variables are all ultimately set in the workflow's configuration sheet. At this point, your best bet is probably to just reinstall a pristine version of the workflow and edit the variables. That's the simplest thing for a user to do. The fix I'm talking about is what @shmulvad should do so users don't have this problem in the future. 46 minutes ago, Buchholdt said: Can you tell if this code is like fx. javascript? Don't know. What is that? In any case, there's no JavaScript in the workflow. It's written in a combination of Python 3 and AppleScript. 46 minutes ago, Buchholdt said: it seems like Javascript is quite popular, and if I can use it here in Alfred, it might be the language for me to try out. I wouldn't call JavaScript "popular" exactly because an awful lot of programmers despise the language. It is extremely common, however. Its status as the only language supported by web browsers ensures that. Almost every programmer knows a bit of JavaScript. Personally, I'd recommend starting with Ruby or Python. They're more sensible, better designed languages. JS and its community have a reputation for being nuts. I'd argue that the best place to start learning to code is probably not out on what most coders consider a lunatic fringe. Edited November 28, 2021 by deanishe Link to comment
Buchholdt Posted December 6, 2021 Share Posted December 6, 2021 Hi again, I manage to understand it now, and I happy too tell that the app now works for me. And regarding the coding, I will give Python a go, as I have read some good things about this as well. And this way I will stay clear of the "lunatics" 🙂 Thank you very much for the help, I really appreciate it. I have just send some beer money money your way, I hope it buys you a cold one. Link to comment
alfredpanda Posted May 17, 2022 Share Posted May 17, 2022 @shmulvad I absolutely love this workflow, but have recently ran in to the following issue. Any chance you could help me debug? Thanks! Link to comment
Vero Posted May 17, 2022 Share Posted May 17, 2022 @alfredpanda Not to take away from the creator's own workflow, but if you're having issues with it, you may also want to consider our official TinyPNG workflow here: https://www.alfredapp.com/blog/tips-and-tricks/tiny-png-workflow-compress-images/ alfredpanda 1 Link to comment
alfredpanda Posted May 17, 2022 Share Posted May 17, 2022 20 minutes ago, Vero said: @alfredpanda Not to take away from the creator's own workflow, but if you're having issues with it, you may also want to consider our official TinyPNG workflow here: https://www.alfredapp.com/blog/tips-and-tricks/tiny-png-workflow-compress-images/ Thanks! I don't know how I missed this. Link to comment
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