# Get a list of available named triggers

**URL:** <https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390>\
**Category:** Feature Requests\
**Tags:** named-trigger\
**Created:** [February 16, 2023, 7:28pm UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390 "2023-02-16T19:28:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnnsmnstrr](https://community.folivora.ai/user_avatar/community.folivora.ai/dnnsmnstrr/32/4181_2.png) [@dnnsmnstrr](https://community.folivora.ai/u/dnnsmnstrr)\
**Post date:** [February 16, 2023, 7:28pm UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390/1 "2023-02-16T19:28:59Z")

</div>

I'm currently trying to use the scripting interface with [Raycast](https://www.raycast.com/) to create an extension that will let me run named triggers in BTT.  
It would be great if there were a way to access the list of available named triggers from outside of BTT. Seems to me like this could be possible, since some button triggers already have a dropdown with such a list:  
 ![Screenshot 2023-02-16 at 20.15.35](https://community.folivora.ai/uploads/default/original/3X/6/b/6b19a772ecdc0bd71662c6d645c3c5a2df405f61.png)

A scripting method similar to `get_trigger`, but for multiple triggers, like `get_triggers` would be a great solution. Then it would be possible to filter the list and run named triggers on demand.  
Apparently [I'm not the first person to request this](https://community.folivora.ai/t/possible-to-get-a-list-of-all-my-named-trigger-or-their-uuids/21532), but I wanted to make a more specific suggestion.  
Another cool idea might be a way to get a list of available actions, that would allow even more options (maybe also from Shortcuts)

I have tried the workaround of exporting my preset and parsing the file for `BTTTriggerName` entries, but this is a manual process and requires multiple steps, which I would like to avoid having to redo everytime I change or add triggers in BTT.

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [February 16, 2023, 8:43pm UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390/2 "2023-02-16T20:43:50Z")

</div>

Good idea, I'll add a function to retrieve triggers with some filter options.

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [February 17, 2023, 4:10pm UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390/3 "2023-02-17T16:10:12Z")

</div>

In 4.026 alpha this would get you all named triggers. This only really works when using Java Script for Automation, because standard Apple Script does not handled JSON well and BTT can only return the data as JSON.

```auto
let BetterTouchTool = Application('BetterTouchTool');
let allNamedTriggersJSONString = BetterTouchTool.get_triggers({trigger_id: 643});
let allTriggersJSONArray = JSON.parse(allNamedTriggersJSONString);

let allNamedTriggerNames = [];
for(let trigger of allTriggersJSONArray) {
	allNamedTriggerNames.push(trigger["BTTTriggerName"]);
}

allNamedTriggerNames

```

The get\_triggers() function supports these parameters (all optional):  
• trigger\_type (e.g. BTTTriggerTypeMagicMouse)  
• trigger\_id (e.g. 643 for named triggers)  
• trigger\_parent\_uuid (if you want to get the items of a folder)  
• trigger\_uuid (to get a specific trigger)  
• trigger\_app\_bundle\_identifier (to get triggers assigned to a specific app)

The same parameters are now also available on a new function called "delete\_triggers()"

//edit: Apple's notary service is currently down, will release the alpha once it's working again

---

<div class="post-metadata">

**Author:** ![dnnsmnstrr](https://community.folivora.ai/user_avatar/community.folivora.ai/dnnsmnstrr/32/4181_2.png) [@dnnsmnstrr](https://community.folivora.ai/u/dnnsmnstrr)\
**Post date:** [February 19, 2023, 4:52am UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390/4 "2023-02-19T04:52:47Z")

</div>

@Andreas_Hegenberg Thank you for implementing my request! I was able to put together the extension with your example code and it works just like I imagined.

[Here is my submission](https://github.com/raycast/extensions/pull/4870) for the Raycast store, I hope you're ok with me using the BTT-Logo, otherwise I could probably find a different icon.

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [February 19, 2023, 7:49am UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390/5 "2023-02-19T07:49:31Z")

</div>

nice!

---

<div class="post-metadata">

**Author:** ![dnnsmnstrr](https://community.folivora.ai/user_avatar/community.folivora.ai/dnnsmnstrr/32/4181_2.png) [@dnnsmnstrr](https://community.folivora.ai/u/dnnsmnstrr)\
**Post date:** [February 24, 2023, 11:57am UTC](https://community.folivora.ai/t/get-a-list-of-available-named-triggers/30390/6 "2023-02-24T11:57:32Z")

</div>

Just created an Alfred workflow as well: [GitHub - dnnsmnstrr/alfred-btt: Alfred workflow to run named triggers and actions in BetterTouchTool](https://github.com/dnnsmnstrr/alfred-btt)
