title: Logitech Mouse Repeat with Toggle
body: <p>I already tried and always ended up by infinite loop.</p>
  
  <p>my code:</p>
  
  <pre><code>toggle_button = 5
  button_toggled = false
  function OnEvent(event, arg)
      if event == "MOUSE_BUTTON_PRESSED" and arg == toggle_button then
          button_toggled = not button_toggled
          if button_toggled then
              while button_toggled do
              OutputLogMessage(tostring(button_toggled))
              Sleep(50)
              end
          else
              button_toggled = not button_toggled
          end 
      end
  end
  </code></pre>