How to create a Butler comand in my Trello Board triggered on Mon, Tue, Wed and Thu only?
Asked by kraeMit:

Hi,

I'd like to create my 'Daily List' by creating a new list and copy my daily card with a checklist to it. So far it works with 2 commands.

I managed to do by the trigger 'every day' but wondering, if I can do this for some days in a week only? Can I creat a list of days somehow?

Thanks for a tip!

Regards  
kraeMit


Answers:
author: Iain Dooley
body: [@kraeMit](/t5/user/viewprofilepage/user-id/4120136) just create 4 commands that run weekly on each of those days

comments: author: milynnus
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) agree. I worked on that add-on module just to see what other ways I can extend the use of the http request. Butler does not support conditions. So this add on uses a list of cards as a lookup to compare it with the {weekday name}. I should think there are other comparative options can can be added.


author: kraeMit
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) : Thanks, that's what I mentioned above as a solution. I will do it.


author: kraeMit
body: Thanks for your postings.

In the moment I'm happy with this commands :

```
every day, create a new list named "KW{weeknumberlong}: {weekdayshort}, {monthdaynumberlong}. {monthshort}" in the top position on board "Daily Task Management mkr"
```

```
every day, copy each card in list "Repeated Cards - don't delete" assigned to me to the top of list "KW{weeknumberlong}: {weekdayshort}, {monthdaynumberlong}. {monthshort}" on board "Daily Task Management mkr"
```

This does the trick, but creates 3 lists which has to be removed manualy. I thought about doing such Butler commands for each day (Mon, Tue, Wed, Thu), but that's somehow more overhead.

I'm wondering what else possibilities one have to create commands, e.g. using python?

Thanks for reading!

comments: author: milynnus
body: [@kraeMit](/t5/user/viewprofilepage/user-id/4120136) You can definitely do it manually for each day that you need to run. The only option in Butler to "create commands" is basically the Butler http request available for paid accounts. I used it to create an Butler add-on so that you can run any piece of python code for things you cannot do in Butler. I built that with a low code automation tool.


author: milynnus
body: [@kraeMit](/t5/user/viewprofilepage/user-id/4120136) I worked on this just for fun. I doubt anyone would want to implement this but it works

```
every day at 5:00 am, create a report in variable "run_days" with all cards in list "? Hot" with the "Run Today" label using pattern "{cardname}^{weekdayname}", post to url "https://25368.wayscript.io/test?registry=None&module=None" with payload "{\"card_id\" : \"5f81a53052ba3b7d2f718666\", \"report_variable\" : \"{$run_days}\"}", and send an email notification to "li....hss@gmail.com" with subject "Is a match found?" and message "If match is found the result will be the new Trigger Card name : {httpresponse.output}"
```

I have a list with cards named Monday through Sunday. Those days I need to run, I will have a label "Run Today" set. Pass the report variable via Butler Http to an endpoint that company the card name with the {weekdayname}. Send email to myself to see results (testing purpose only)
> item_list = para\['report_variable'\].split("\\n")  
> item_list.pop() #remove last element
>
> <br />
>
> run_flag = False  
> for item in item_list:  
> split_item = item.split("\^")
>
> if split_item\[0\] == split_item\[1\]:  
> add_to_cardname = split_item\[0\]  
> run_flag = True  
> break
>
> <br />
>
> if run_flag == True:  
> trigger_card = client.get_card(para\['card_id'\])  
> card_new_name = '''{} {}'''.format(trigger_card.name, add_to_cardname)  
> trigger_card.set_name(card_new_name)

if there is a match change the Trigger card name as a way trigger the processing you need. It can be other ways.

```
when the name of a card contains "{weekdayname}", add the red "Butler Will Run Today" label to the card
```

Above is based on technique I developed. More details are available on [Extending "A Powerful Combination" post.](https://community.atlassian.com/t5/Trello-discussions/Extending-quot-A-Powerful-Combination-quot/m-p/1491515#M1461)

Below is a picture of the list.

![Screen Shot 2020-10-10 at 9.16.27 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/113808i10869145DD9ABD9C/image-size/large?v=v2&px=999 "Screen Shot 2020-10-10 at 9.16.27 PM.png")

comments: author: milynnus
body: [@kraeMit](/t5/user/viewprofilepage/user-id/4120136) i have made the above generic to be able to compare any card variable with a value or Trello variable and to set a label which can be used by Butler. It can be useful other types of trigger not supported by Butler


author: tokcum
body: Hi kraeMit,

in most cases when there are triggers within Jira they are based on Cron expressions. Also many 3rd party add-ons leverage Cron expressions. They are a little bit different from Cron expressions you may be familiar with in Linux though.

Please have a look at this article. It's very technical but the examples help in getting started.

[Construct cron expressions](https://support.atlassian.com/jira-software-cloud/docs/construct-cron-expressions-for-a-filter-subscription/)

If you feel uncomfortable with this, feel free to contact me again.

Kind regards,

Tobias

comments: author: tokcum
body: Sorry, my reply was misleading. I did some research on Trello and realized that Trello doesn't support Cron expressions.


Tags: butler

schedule