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.
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
In this guide · 5 sections
Streaming live or managing complex workflows often feels like balancing on a tightrope. One accidental tap on your macro deck could end your stream, mute your microphone at the wrong moment, or delete a crucial file. A simple Are you sure? mechanism acts as a safety switch for these high-risk actions. This guide shows you how to build a smart confirmation button in Touch Portal that requires a deliberate double-tap to execute, preventing those heart-stopping misclicks.
The Logic: How the Safety Switch Works
Before diving into the editor, understanding the concept is key to customizing it later. We are building a State Machine.
The button will have two modes:
Locked Mode (Default): The dangerous action is disabled. Pressing the button only arms it for a few seconds.
Armed Mode: The button changes appearance to signal danger (e.g., turns red). If you press it again within the time window, the action fires. If you do nothing, it automatically locks itself again.
This method is superior to a simple Long Press because it gives you clear visual feedback and a specific window of opportunity to confirm your intent.
Step 1: Setting Up the Custom State (The Brain)
Touch Portal needs a memory to track whether the button is currently locked or armed. We use Values for this. Think of this as creating a specialized variable just for this button.
Open the Touch Portal desktop app. On the left sidebar, click on the Values tab.
Click the Add Value button to create a new entry.
Crucial Step: Fill in the Details
ID: Enter
id_safety_switch(Use underscores, avoid spaces. This is how the system identifies it).Name: Enter
Safety State(This is just for you to read).Type: Select Number (This ensures the system treats 0 and 1 as mathematical values, not text).
Default Value: Set this to 0.
Click Save.
Why 0? We use 0 to represent Locked/Safe and 1 to represent Armed/Ready. By setting the default to 0, your button always starts in a safe state when you launch the app.
Step 2: Configuring the 'On Press' Logic
Now you need to program the button to check this value every time you touch it. Drag a new button onto your page and follow this logic structure in the On Press section.

You will use an If Statement to check the current state of your id_safety_switch value.
The Trigger (First Press)
Add an If block checking if id_safety_switch is 0. Inside this block, add these actions:
Set Value: Change
id_safety_switchto 1. This unlocks the safety catch.Wait: Add a Wait Timer for 3000 ms (3 seconds). This is your window of opportunity.
Set Value: Change
id_safety_switchback to 0. This ensures that if you don't press the button again, it locks itself automatically.
The Action (Second Press)
Right after the If block (not inside it), add an Else block. This part runs only if the button is pressed while the state is already 1 (during that 3-second window). Inside the Else block:
Execute Logic: Place your dangerous action here (e.g., Switch Scene, OBS Command, Key Press Alt+F4).
Set Value: Change
id_safety_switchback to 0 immediately. This resets the button to its locked state right after the action is performed.
Step 3: Visual Feedback (The 'On Event' Section)
A safety switch is useless if you don't know it is active. You need the button to scream CONFIRM ME when it is armed.

Go to the On Event tab of your button. This section monitors changes in real-time.
Add an event: When Value Changes. Select your
id_safety_switchvalue.Set the condition to When value is 1.
Inside this event, add visual changes:
Change Button Background: Set it to a bright warning color like Red or Orange.
Change Button Title: Change the text to SURE? or CONFIRM.
Change Icon: Optionally swap the icon to a warning triangle.
Create a second event for When value is 0 to revert these changes (set color back to transparent/default and text back to the original Action Name).
Why This Method is Essential for Streamers
Using a state-based confirmation system protects your workflow without slowing you down. Unlike a pop-up window that requires mouse interaction, this keeps your hand on the macro deck. You tap once to arm, see the red flash, and tap again to fire. It becomes muscle memory.
You can apply this logic to any high-risk toggle:
End Stream: Prevent cutting off your audience mid-sentence.
Delete Clips: Secure your file management commands.
Smart Plugs: Avoid accidentally turning off your key lights or PC power.
By implementing this logic, you transform your Touch Portal setup from a simple remote into a professional control surface that understands context and intent.
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.