Tutorial: App Buttons
Let's learn how to add App Buttons for running your script.
Usecase: Count Cards
In this tutorial, we'll add a button that counts the number of cards in a board, and adds the count to the board name.
Enter the following code into your script:
import trello_app
def count_cards():
# get old board name
board = trello_app.get_current_board()
old_board_name = board.get_name().split(" [")[0]
# get all open cards
card_count = len(board.get_cards(filter="open"))
# set board name with card counts
board.set_name("%s [%s]" % (old_board_name, card_count))
Run the script from your editor
We can test this script by clicking the Run button as follows.
Using an App Button
Rather than only use the Run button in the editor, we can also close the editor and use an App Button.
Go back to the app. Rather than clicking the Blockspring leaf to open the editor, hover and click on your function name (in this case count_cards
).
Need Help?
If you run into any issues, or what to chat with others, connect to the Blockspring community right from the Scripts editor.
Updated less than a minute ago