Triggers for external programs
The photo booth reports steps of its session to the outside: to an address on the network or to a program on its own computer. This ties in equipment for which there is no area of its own.
It is switched on in the admin area "Lighting / accessory control" > "Triggers for external programs". This chapter describes what arrives there and how to work with it.
What this is good for#
A few tasks from practice that can be solved with it:
- Control a ring light or flash system that comes with its own software. Ramp up during the countdown, switch off at the moment of capture.
- Switch a socket as soon as a session begins, and off again after the final screen - through home automation.
- Pass on finished pictures: copy, rename, drop into a folder, hand over to an image editor.
- Keep count of how many sessions and prints have added up, without asking the photo booth for it.
- Fog machine, light organ, confetti cannon - anything that reacts to a signal.
- Run a display alongside, such as a second screen in the next room showing what is happening right now.
The photo booth expects no answer and evaluates none. It only reports.
Setting up in three steps#
- Choose the target. Either an address on the network or a program on the photo booth's computer. For a program, the full path including the file extension belongs in the field.
- Tick the events. Only what is ticked gets reported. Anyone who first wants to find out what arrives when ticks everything and removes later what is not needed.
- Test. The "Test event" button sends a single event with sample values and shows the command that actually went out - and, on failure, its cause.
The two routes#
Address on the network#
The photo booth calls an address and appends the values as parameters:
http://127.0.0.1:8000?event_type=session_start¶m1=photo
event_type names the event, param1 to param4 the additional values. Special characters are encoded, as usual for internet addresses.
A POST with JSON can be sent instead:
{"event_type": "session_start", "param1": "photo"}
The first format fits existing scripts and simple devices, the second newly written receivers.
Program on this computer#
The photo booth starts the given program and passes the values as arguments in a fixed order
- first the event name, then the additional values:
My-Script.bat session_start photo
The program runs without a visible window. Its working directory is the folder it sits in, so neighbouring files can be called by their bare name.
Reference: the nine events#
In the order of the session. A value that an event does not carry stays empty but keeps its place.
Session starts#
The guest has chosen the capture mode, the session has been created.
| Value | Content |
|---|---|
| 1 | Capture mode: photo, gif, boomerang or ai_portrait |
My-Script.bat session_start photo
Countdown begins#
Arrives before every single shot, so four times for a four-shot layout.
| Value | Content |
|---|---|
| 1 | Duration of the countdown - in seconds, optionally in milliseconds |
My-Script.bat countdown_start 3
Shutter release#
The moment of capture. Also arrives before every single shot, immediately before the picture is taken.
This event carries no additional values.
My-Script.bat capture_start
Photo received from the camera#
The camera has delivered a picture and it is on the hard disk. Arrives only with a connected photo or system camera, not with a webcam - there the picture is created in the interface.
| Value | Content |
|---|---|
| 1 | Full path to the unaltered camera file |
My-Script.bat file_download "C:\...\sessions\20260918\dslr_raw\shot_01.jpg"
Processing begins#
All shots are in, the finished picture is now being computed: cutout, filter, layout. Depending on the settings this takes a few seconds.
| Value | Content |
|---|---|
| 1 | The source files, separated by semicolons |
| 2 | Path at which the finished picture will be created |
My-Script.bat processing_start "C:\...\shot_01.jpg;C:\...\shot_02.jpg" "C:\...\final.jpg"
The target path is already fixed before anything is computed. A script can therefore prepare itself instead of searching the folder. The file itself does not exist yet at this point.
Final screen appears#
The finished picture is on show, the guest decides about printing and sharing.
This event carries no additional values.
My-Script.bat sharing_screen
Print job sent#
A print has been started - by the guest or automatically.
| Value | Content |
|---|---|
| 1 | Path to the file being printed |
| 2 | Number of copies |
| 3 | Name of the printer |
My-Script.bat printing "C:\...\final.jpg" 2 "DS-RX1"
What is reported is that the job has left the photo booth. Whether the paper actually comes out is known only to the printer.
Upload finished#
A picture has arrived at the cloud target.
| Value | Content |
|---|---|
| 1 | Path to the uploaded file |
| 2 | Address of the picture, if the target supplies one |
| 3 | File extension, such as jpg or mp4 |
| 4 | Identifier of the target |
My-Script.bat file_upload "C:\...\final.jpg" "https://.../s/abc" jpg Wedding
Session ends#
The session returns to the start screen - after the final screen, after the timer has run out or because the guest cancelled.
This event carries no additional values.
My-Script.bat session_end
What arrives when#
A complete run with a layout of two shots, printing and upload:
session_start photo
countdown_start 3
capture_start
file_download C:\...\shot_01.jpg
countdown_start 3
capture_start
file_download C:\...\shot_02.jpg
processing_start C:\...\shot_01.jpg;C:\...\shot_02.jpg C:\...\final.jpg
sharing_screen
printing C:\...\final.jpg 1 DS-RX1
file_upload C:\...\final.jpg https://.../s/abc jpg Wedding
session_end
With a webcam the file_download lines are missing. If the guest cancels, session_end arrives without the lines before it. Printing and upload only arrive when they are switched on and the guest triggers them.
Reading the values correctly#
In a batch file#
The values are available as %~1, %~2 and so on. The tilde belongs there: values containing spaces, equals signs, commas or semicolons are passed in quotation marks, and %~2 removes them again. With %2 they would stand in the text.
@echo off
if /i "%~1"=="printing" (
rem %~2 = file, %~3 = number of copies, %~4 = printer
echo Printing %~3 copies on %~4
)
Simple values without special characters - such as a countdown duration - arrive without quotation marks and can also be read with %2.
In PowerShell#
param([string]$Event, [string]$Value1, [string]$Value2, [string]$Value3, [string]$Value4)
Seconds or milliseconds#
By default the countdown duration goes out in seconds. Some devices expect milliseconds - for that there is the tick box "Give the countdown duration in milliseconds" in the admin area. 3 then becomes 3000.
If a countdown animation stays dark or is over instantly, this unit is almost always the reason.
Ready-made examples#
The files can be downloaded, put into a folder of their own and entered as the target in the admin area. They are meant as a starting point and may be changed.
Log every event#
Writes every call with time, event and all values into a text file next to the script. The first step for everything else.
Download ausloeser-protokoll.bat
Control a device over the serial port#
Sends one command each on countdown and on shutter release to a device on COM3 - the pattern ring lights and similar controllers work by. Commands and port are entered at the top of the script.
Download ausloeser-seriell.bat
Copy and rename finished pictures#
Puts every finished picture into a target folder as well, with date and time in the name. Useful for a photographer working on in parallel.
Download ausloeser-kopieren.ps1
A small receiver for the network route#
A program that listens on an address and shows every event. For trying out the network route before the actual target device is connected. Requires an installed Python runtime.
Download ausloeser-empfaenger.py
Home automation#
Systems such as Home Assistant, ioBroker or Node-RED accept a call over the network. Their address is entered as the target, for example:
http://192.168.1.50:8123/api/webhook/photobooth
An automation is then triggered there. The event is in event_type, and because the values come along as parameters, session start and session end can be told apart without setting up a separate address for every event.
If the system expects JSON instead of parameters, the format is switched over in the admin area.
Troubleshooting#
Nothing arrives at all#
Check in this order:
- Is "Use triggers" switched on and saved?
- Is the event in question ticked?
- For a program, does the field hold the full path including the file extension?
- What does the "Test event" button say? It shows the command that goes out and, on failure, its cause.
- Is writing allowed in the folder where the script wants to create its file?
The script runs but does nothing#
A script that looks for neighbouring files in the photo booth's folder will not find them - it runs in its own folder. Paths inside the script should therefore be given in full or based on %~dp0, its own folder.
Values are in the wrong place#
Almost always the difference between %2 and %~2. See "Reading the values correctly" above.
The guest experience stalls#
That must not happen, and it is then not down to the trigger: the photo booth waits at most the configured time limit and then carries on, even if the target does not answer. The time limit can be shortened when a sluggish device is involved.
An event arrives several times#
That is usually correct: countdown and shutter release arrive before every single shot. With a four-picture layout, therefore four times.