# Help to figure out easy macro...?

**URL:** <https://community.keyboard.io/t/help-to-figure-out-easy-macro/1476>\
**Category:** Plugins\
**Created:** [May 7, 2018, 12:41am UTC](https://community.keyboard.io/t/help-to-figure-out-easy-macro/1476 "2018-05-07T00:41:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [May 7, 2018, 9:31am UTC](https://community.keyboard.io/t/help-to-figure-out-easy-macro/1476/2 "2018-05-07T09:31:55Z")

</div>

The `()` on tap and `{}` on shift-tap is reasonably easy to do with a macro. If you want it to do something on double-tap, the `Macros` plugin is not enough then, at least, not easily. That’s where [`TapDance`](https://github.com/keyboardio/Kaleidoscope-TapDance) comes into play.

Without the double-tap, this is roughly how it would look:

```auto
const macro_t *macroParens(bool left) {
  if (kaleidoscope::hid::wasModifierKeyActive(Key_LeftShift) || 
      kaleidoscope::hid::wasModifierKeyActive(Key_RightShift)) {
    if (left) {
      return MACRO(T(LeftBracket));
    } else {
      return MACRO(T(RightBracket));
    }
  } else {
    if (left) {
      return MACRO(D(LeftShift), T(9), U(LeftShift));
    } else {
      return MACRO(D(LeftShift), T(0), U(LeftShift));
    }
  }
}

```

And you can call it from `macroActions` like this:

```auto
case M_LPAREN:
    if (keyToggledOn(keyState))
      return macroParens(true);
    break;
case M_RPAREN:
  if (keyToggledOn(keyState))
    return macroParens(false);
  break;

```

With `TapDance`, it would look similar, except it has to handle the double-tap case too. I’ll post an update with some code later today to show you how that’s done too.

---

_[View the full topic](https://community.keyboard.io/t/help-to-figure-out-easy-macro/1476)._
