# Trigger different actions on multiple presses of the same shortcut

**URL:** <https://community.folivora.ai/t/trigger-different-actions-on-multiple-presses-of-the-same-shortcut/4011>\
**Category:** Feature Requests\
**Created:** [September 27, 2018, 12:14pm UTC](https://community.folivora.ai/t/trigger-different-actions-on-multiple-presses-of-the-same-shortcut/4011 "2018-09-27T12:14:39Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![yuuiko](https://community.folivora.ai/user_avatar/community.folivora.ai/yuuiko/32/31891_2.png) [@yuuiko](https://community.folivora.ai/u/yuuiko)\
**Post date:** [November 26, 2018, 7:49pm UTC](https://community.folivora.ai/t/trigger-different-actions-on-multiple-presses-of-the-same-shortcut/4011/4 "2018-11-26T19:49:10Z")

</div>

You could make a toggle switch with applescript and BTT variables.

So far for me, my toggle switchs are working pretty well over at [AquaTiuch](https://community.folivora.ai/t/b3-0-2-aquatouch-supports-35-apps-and-websites-and-the-native-touchbar-no-compromises/1704)

I’m not using a three-function toggle, but here’s how it would look like in pseudocode:

start script

(makes the variable and sets it if it doesn’t exist)  
if ThisTriggerState is missing value  
set persistent BTT variable “ThisTriggerState” to 1  
end if

if state is 1  
do named trigger 1  
set “ThisTriggerState” to 2  
exit

else if state is 2  
do named trigger 2  
set “ThisTriggerState” to 3  
exit

else if state is 3  
do named trigger 3  
set “ThisTriggerState” to 1  
exit

end if  
end script

---

_[View the full topic](https://community.folivora.ai/t/trigger-different-actions-on-multiple-presses-of-the-same-shortcut/4011)._
