Setting up an action, repeating until a condition changes

Hey, all!

This must be something obvious, but I did try and failed to find any solution, so if only you would kindly allow I'd ask here.

I want to set up a shortcut in BTT so that, once I trigger it, the thing would start repeating an action until a certain condition changes. Say – sending a keyboard shortcut every other second until I move the cursor.

Is there a way in BTT to set this up?

(It seems devilishly obvious, yet it escapes me how to go about it.

And, yes, I just want the ever lovely Youtube to keep the progress bar shown, and sending «<» or «>» brackets periodically seems like a possible way to do that. For lack a better soution ((. )

Thank you all so much.

And thank you, Andreas, for your hard work!

Hi @Mark_K , this should be possible to implement using BTT. However, the simplest solution would be to install an extension like Permanent Progress Bar for YouTube. I'm however generally not a fan of browser extensions for privacy, security and performance reasons.

For a BTT implementation, you could follow these general steps:

  1. Create a Conditional Activation Group (CAG)

    :information_source: Creating a CAG means you'll be able to define triggers that are only triggerable when certain conditions are met. For our purpose, these conditions will check if you're currently watching a YouTube video. This is helpful because then we'll be able to neatly group the triggers and actions for this project as well as ensure the triggers are only triggerable when you want them to be.

    • Steps:
      1. Click on the plus button at the bottom left corner of the BTT GUI and select Create CAG.
      2. Click Edit Conditions For Group
      3. Setup the conditions to something like this:
        (focusedElementRole != "AXTextArea" AND focusedElementRole != "AXComboBox") AND activeWebsiteURL BEGINSWITH "https://www.youtube.com/watch?" AND (appName == "Google Chrome" OR appName == "Safari" OR appName == "Firefox")
  2. Create a Repeating or Time Based Trigger

    :information_source: With this trigger type, we can define the time interval for how often we want to run an action as well as configure conditions for when the Trigger is able to run (note, these are not the same conditions as the conditions we previously configured in the CAG).

    • Steps:
      1. Under Automations & Named & Other Triggers, create a Repeating or Time Based Trigger.
      2. Under When to Trigger, set Repeat every: to 2.
      3. Click on Advanced Conditions...
      4. Configure the conditions like so:
        fingers_touching_trackpad == 0
  3. Add a Send Keyboard Shortcut action:

    :information_source: This action should now only be executable if you're currently watching a YouTube video and you're not touching the trackpad.

    • Steps:
      1. Click on the plus symbol to add a new action for our Repeating or Time Based Trigger.
      2. Click on Click to record shortcut under Send Keyboard Shortcut as the action type.
      3. Press the keyboard sequence you want to send every 2 seconds, i.e. «<» or «>».

To help debug, under HUD Overlay, I suggest you toggle on Show when triggered. This way, you'll be able to tell if the action is running every 2 seconds.

I completed the above steps and I confirm that it works.

Dear Fortred!

I have somehow missed the notification about your reply, and have only seen it now, and only write now, so very much belatedly.

I am at a loss for words to tell you how amazed I am that someone could take so much time, care and thought to reply to a random dude's question.
Thank you so, so much!
You've even thought of conditioning for youtube and its text input boxes. I've thought of that! I know how to do this! But to think that someone would care to ever bother. I am truly speechless.

Thank you ever so much!

I'm just left to marvel at this community that Andreas' work has created. At how ready to help it is. At how humanity still has people like you up its sleeve.

1 Like