devcrea

How to Create an Are You Sure? Button in Touch Portal

Prevent accidental clicks! Learn how to create an Are You Sure? confirmation button in Touch Portal using states and logic logic for dangerous actions.

// The short answer

Build a Touch Portal confirmation button as a two-state safety switch: the first press arms the action and changes the button's visual state, while a second press within the timeout executes it. If the second press never arrives, reset the button automatically. This deliberate double-tap pattern protects destructive macros without relying on an ambiguous long press.

Full walkthrough, edge cases and why it works
In this guide · 5 sections
  1. 01The Logic: How This Little Safety Catch Works
  2. 02Step 1: Giving Touch Portal a Memory (Custom Value)
  3. 03Step 2: Wiring Up the 'On Press' Logic
  4. 04Step 3: Giving Yourself a Warning Flash ('On Event')
  5. 05Why This Belongs in Your Daily Setup

Anyone who streams or runs complex desk automations knows that cold-sweat feeling when your hand slips. One careless bump against your stream deck, and suddenly your broadcast cuts to black, your hot mic gets muted right during a punchline, or an essential folder gets nuked into oblivion.

A straightforward Are you sure? confirmation acts like a flip-cover on a missile switch for those high-stakes actions. Here’s a walkthrough on setting up a clever confirmation button in Touch Portal that demands a quick, deliberate double-tap, saving you from those agonizing misclicks.

The Logic: How This Little Safety Catch Works

Before jumping straight into the button settings, it helps to see what’s going on under the hood so you can tweak it to your liking later. Technically speaking, we’re just building a mini State Machine.

The button lives in one of two distinct modes:

  1. Locked Mode (Normal): The destructive command stays safely offline. Giving the button a tap won't fire the action; it merely primes the system for a few seconds.

  2. Armed Mode: The tile shifts its appearance to let you know it's hot (say, glowing bright crimson). Tap it again while the clock is ticking, and the command triggers. Let it sit untouched, and it quietly re-locks itself.

This approach feels leagues better than a generic long-press, mainly because it serves up instant visual feedback alongside a dedicated, well-defined grace period to make your move.

Step 1: Giving Touch Portal a Memory (Custom Value)

Touch Portal has to remember whether the switch is currently sitting harmlessly locked or primed to fire. We handle this using Values, which you can think of as a dedicated little sticky note the app keeps in its back pocket.

  1. Open up the Touch Portal desktop suite. Over on the left-hand rail, pop open the Values tab.

  2. Hit Add Value to spin up a fresh one.

  3. Now for the Important Bit: Fill Out These Fields

  • ID: Type in id_safety_switch (keep it clean with underscores and skip the spaces so the app references it cleanly).
  • Name: Label it Safety State (this label is just for your own sanity when glancing through lists).
  • Type: Pick Number (this tells Touch Portal to treat 0 and 1 as straight numeric values rather than raw text).
  • Default Value: Punch in 0.
  1. Smack Save.

Why stick with 0? It’s a clean binary standard: 0 means Disarmed/Safe, while 1 means Armed/Hot. Making zero the default guarantees your board always boots up completely safe whenever you boot up your computer or launch the app.

Step 2: Wiring Up the 'On Press' Logic

Next up, we need to instruct the button to peek at that value the moment your finger touches the glass. Drop a fresh button onto your grid and arrange the logic inside the On Press tab like this:

We’re going to lean on a standard If Statement to inspect what id_safety_switch is doing in real time.

The Primer (First Tap)

Drop in an If block that looks for id_safety_switch equaling 0. Inside that block, layer these actions:

  • Set Value: Flip id_safety_switch to 1. That thumbs the safety catch open.

  • Wait: Slot in a Wait Timer set to 3000 ms (a nice 3-second window). This sets your confirmation timer.

  • Set Value: Revert id_safety_switch back to 0. That way, if you chicken out or tapped it by accident, the button quietly puts itself back on safe mode.

The Trigger (Second Tap)

Directly underneath that initial block (make sure you don't nest it inside), attach an Else block. This only kicks into gear if you tap the screen while the state is sitting on 1 - right inside that three-second grace period. Inside the Else block:

  • Execute Logic: Drop your risky command right here (killing the stream, running an OBS macro, or firing off a hotkey combo).

  • Set Value: Set id_safety_switch back to 0 immediately. This resets the whole mechanism back to cold the second your command goes through.

Step 3: Giving Yourself a Warning Flash ('On Event')

A safety catch isn't much help if you can't tell it's live at a glance. You want the button face to scream HIT ME AGAIN the moment it gets primed.

Head over to the button's On Event tab. This spot is built specifically to watch for background changes on the fly.

  1. Hit add event and select When Value Changes, pointing it at your id_safety_switch value.

  2. Set up the rule so it listens for When value is 1.

  3. Tucked inside this event, stack your cosmetic alerts:

  • Change Button Background: Flip the background over to an unmissable shade like hot red or amber.
  • Change Button Title: Swap out the label text to SURE? or ARMED.
  • Change Icon: Swap out the graphic for an exclamation mark or hazard icon if you'd like.

Build out a matching companion event right below it for When value is 0 to walk everything back - dropping the background to transparent or dark grey and restoring your default title so it returns to resting mode.

Why This Belongs in Your Daily Setup

A state-checked trigger keeps you from ruining your own day without forcing you to slow down to a crawl. Rather than dealing with clunky desktop dialogue boxes that make you grab your mouse, you never have to take your eyes or hand off your pad. Tap once to prime, spot the quick color switch, tap again to pull the trigger - it quickly turns into pure muscle memory.

You can borrow this exact blueprint for practically any command that makes you nervous:

  • End Stream: Zero chance of abruptly cutting yourself off while wrapping up your final thought.

  • Wipe Directory / Clear Cache: Keeps quick-maintenance shortcuts from becoming accidental disaster zones.

  • Smart Plugs & Relays: Stops you from killing your studio key lights or rig power mid-recording.

Once you wire a couple of these up, Touch Portal stops feeling like a glorified digital toy and starts handling like a tailored, professional broadcast console that genuinely watches your back.

Quick answers

Frequently asked questions

How do I create a confirmation button in Touch Portal?

To create a confirmation button in Touch Portal, you must use a custom Value to track the state of the button. The logic involves setting this value to 1 on the first press to arm the button and only executing the actual command if the button is pressed again while the value is still 1.

How can I prevent accidental clicks on my Touch Portal deck?

You can prevent accidental clicks by implementing a safety switch mechanism that requires a deliberate double-tap to trigger an action. This method uses conditional logic to ensure that a single stray touch only changes the button's visual state without running the dangerous command.

What does the Wait action do in Touch Portal logic?

The Wait action pauses the execution of the button's script for a specific duration defined in milliseconds. In the context of a safety button, this timer creates a temporary window of opportunity where the button remains armed before automatically resetting itself to a locked state.

How do Custom Values work in Touch Portal?

Custom Values act as variables or memory slots that store data to control the behavior of your buttons. For a confirmation button, a custom value serves as a flag that remembers if the button has been pressed once, allowing the system to distinguish between a first tap and a confirmation tap.

Can I change the button icon or color when pressed in Touch Portal?

Yes, you can dynamically change a button's icon, background color, or title by using the On Event section of the button settings. You can configure the button to turn red or display a warning text specifically when your custom safety value changes to the armed state.

Is it possible to create a double tap action in Touch Portal?

Yes, you can simulate a double tap action by using an If-Else logic structure combined with a timer. The first tap sets a temporary value that acts as a primer, and if you tap again before the timer resets this value, the system recognizes it as a double tap and executes the command.

Why does my Touch Portal button not reset to its default state?

Your button may fail to reset if the logic script is missing the final command to revert the custom value back to zero. You must ensure that a Set Value action is placed immediately after the Wait timer so that the button automatically returns to its locked mode if you do not confirm the action in time.

Can I use this safety logic for OBS commands?

Yes, this safety logic is ideal for controlling critical OBS commands like streaming, recording, or switching scenes. By placing the OBS specific action inside the confirmation block, you ensure that you never accidentally end your stream or cut to a black screen during a live broadcast.

Something wrong or out of date?

Tools change fast. Tell the editor what no longer works.