Mehdi Posted April 23, 2017 Share Posted April 23, 2017 (edited) Hi everyone, I'm trying to use Alfred with Trello to add cards faster, for some reasons both workflows I found either won't work or don't offer add feature. So I managed by reading the codes etc to create a workflow that works, only issue is if I have spaces in {query} like "with spaces", it will create a card called "with", and if I check espaces spaces the card created will be called "withspaces" ... any idea how to fix this ? This is the command I use : curl -f --connect-timeout 3 https://bot.trellobutler.com/scripts/aaaaa?title={query} || : Thanx a lot for any help you guys can give me Mehdi Edited April 24, 2017 by Mehdi Removed “Please help!” (serves no purpose and is only distracting) and corrected “bash” Link to comment
dunkaroo Posted April 24, 2017 Share Posted April 24, 2017 This link should help you out. or search forum. "query encode", I don't know how to do it but little search helps Mehdi 1 Link to comment
vitor Posted April 24, 2017 Share Posted April 24, 2017 (edited) Hello and welcome, @Mehdi, For one, you should be quoting that URL ('https://bot.trellobutler.com/scripts/aaaaa?title={query}'). But apart from that, if you want to be safe and URL-encode every character, keep selected in the Escaping options Backquotes, Double Quotes, Backslashes, and Dollars. In your code do: your_text="$(perl -MURI::Escape -ne 'print uri_escape ($_)' <<< "{query}")" curl -f --connect-timeout 3 "https://bot.trellobutler.com/scripts/aaaaa?title=${your_text}" The first line URL-encodes every character in your {query} in a your_text variable. The second line uses it. That should sort you, but in the future please read the Reporting Problems with Workflows topic and follow it. It gives a nice overview on how to make a report with a better chance of being addressed. Edited April 24, 2017 by deanishe remove API key Mehdi 1 Link to comment
Mehdi Posted April 24, 2017 Author Share Posted April 24, 2017 Thanx a lot @dunkaroo and @vitor ! Really appreciate the help. Got it vitor, i'll follow those guidelines next time, I love alfred and i'm just starting to play with creating my own workflows so there will probably be a next time hehe. One thing vitor, could you please edit out the url like I did in my initial post please (replace the id in the url by aaaaa or anything else), just a preventive measure to avoid having my trello spammed, should have thought about it before posting. Mehdi Link to comment
Mehdi Posted April 24, 2017 Author Share Posted April 24, 2017 (edited) 32 minutes ago, vitor said: your_text="$(perl -MURI::Escape -ne 'print uri_escape ($_)' <<< "{query}")" curl -f --connect-timeout 3 "https://bot.trellobutler.com/scripts/aaaaa?title=${your_text}" I get an error .. [ERROR: action.script] % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0 curl: (28) Operation timed out after 3002 milliseconds with 0 out of 0 bytes received I also tried changing "{query}" by '{query}' as " inside " seemed weird but same error still .. Mehdi Edited April 24, 2017 by Mehdi Link to comment
vitor Posted April 24, 2017 Share Posted April 24, 2017 25 minutes ago, Mehdi said: I also tried changing "{query}" by '{query}' as " inside " seemed weird but same error still .. Don’t. All the quote types were deliberate. It’s not " inside ", it’s " inside "$()". In that instance double quotes don’t cancel each other out, and you need them. If you use single quotes you either break the whole expression (if outer quotes) or break the escaping (if inside quotes). As for your error, you’re giving curl a specific timeout and getting it. Can’t say that is unexpected. Remove the timeout and see what happens. Or try echoing your_text and try it with that in the CLI. Something. Link to comment
Mehdi Posted April 24, 2017 Author Share Posted April 24, 2017 Now it works so it was indeed the timeout stopping it, thanx a lot Though it still says "[ERROR: action.script]" in the logs, and it takes about 6 seconds for a simple curl ping .. not the most efficient for quick add as I have to wait for the confirmation notification before moving on :/ Mehdi Link to comment
vitor Posted April 24, 2017 Share Posted April 24, 2017 9 minutes ago, Mehdi said: Though it still says "[ERROR: action.script]" Which is why this is important: 1 hour ago, vitor said: read the Reporting Problems with Workflows topic and follow it. I don’t have access to your workflow. I can’t debug what I can’t test. Link to comment
Mehdi Posted April 24, 2017 Author Share Posted April 24, 2017 9 minutes ago, vitor said: Which is why this is important: I don’t have access to your workflow. I can’t debug what I can’t test. You're right. Here's the workflow : https://drive.google.com/open?id=0B6iNJEvkpFeeV1lxX3VNX2NtWlE As for my configuration : - Alfred 3 - Mac OS Sierra 10.12.5 No changes to the default configuration. Mehdi Link to comment
vitor Posted April 24, 2017 Share Posted April 24, 2017 (edited) The problem for the delay might be in your connection or a temporary blip on their side. I just did the test and adding the card seemed instant. As for the error you’re getting, that isn’t really an error — it’s just that curl’s progress is output to stderr. Nothing to worry about. Since you actually don’t care about seeing the progress, add the --silent flag to the curl command. Also, I suggest you change -f to --fail. Short flags are fine when typing a command but are less useful in a script where comprehension is more important than speed. When you can understand what a command is doing without having to open the man page and check every flag because they consist of a single letter, you have a better experience and might be more inclined to fix bugs if an outsider to the code (and many times you’ll be your own outsider, as you don’t remember your code). Edited April 24, 2017 by vitor Mehdi 1 Link to comment
Mehdi Posted April 24, 2017 Author Share Posted April 24, 2017 I added the --fail and --silent. Also, you're right it's instant, I was uploading a youtube video in the background that's what was slowing the internet down.. I feel like such a newbie on this one, sorry Thanx a ton for your help, now I have Airmail, Trello and Youtube all perfectly setup on Alfred .. feels like the beginning of a love story between a man and a software Mehdi dunkaroo 1 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