title: Hi how to use the lua script in order to toggle macro on and off
body: <pre><code>function OnEvent(event, arg, family)
  
  if (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 and family == &quot;mouse&quot;) then
  
  PlayMacro(&quot;Lustre Rotation&quot;)
  
  end
  
  if (event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 5 and family == &quot;mouse&quot;) then
  
  AbortMacro()
  
  end
  
  end
  </code></pre>
  <p>Hi I've been using the lua script (on Logitech G Hub) above in order to stop the macro as soon as I release the mouse button, but I don't wanna hold mouse button, instead I want to use the mouse button to toggle the macro. Please guide me through the script how to change to toggle on/off macro with mouse button. Thank you!</p>