System & device commands
These commands interact directly with the physical Upload button on the Mantis device.
WAIT_FOR_BUTTON_PRESS
Halts the entire script until the physical Upload button on Mantis is pressed, then continues execution.
1REM Set typing speed2SET_SPEED $Human34STRING waiting for user input...5REM Pause script completely until button is pressed6WAIT_FOR_BUTTON_PRESS7STRINGLN Continuing after the press.BUTTON_DEF … END_BUTTON
Defines a background handler block that runs whenever the button is pressed while the rest of the script is executing. The main script pauses at the next safe point, the handler runs, and then the main script picks back up exactly where it left off.
This is perfect for triggering an app or payload repeatedly on demand.
1REM Define the background handler to open an app2BUTTON_DEF3 REM Set typing speed for the handler4 SET_SPEED $Human5 6 REM Open the run dialog7 GUI r8 DELAY 5009 10 REM Type the app name and execute11 STRINGLN calc.exe12END_BUTTON1314REM Main script execution15REM Set typing speed for the main script16SET_SPEED $Human1718STRING This script is running...19DELAY 500020STRING ...and you can press the button at any time to open the calculator.- Only one
BUTTON_DEFis allowed per script. - A
BUTTON_DEFcan’t be defined inside aFUNCTION, and aFUNCTIONcan’t be defined inside aBUTTON_DEF— but the handler body can call functions defined elsewhere. - If a
WAIT_FOR_BUTTON_PRESSis actively waiting when the button is pressed, that wait is satisfied first — the handler does not also fire for that same press.
Once the main script finishes, if it defined a BUTTON_DEF, Mantis stays resident
and keeps running the handler on every subsequent press for as long as it’s
plugged in.
BUTTON_PRESSED (Condition)
Unlike the commands above which wait or run in the background, BUTTON_PRESSED is a boolean condition used inside IF blocks to actively check if the button is currently being held down.
This is highly useful inside LOOP blocks to break out of continuous actions.
1REM Set typing speed2SET_SPEED $Human34REM Loop infinitely5LOOP6 REM Check if the button is currently held down7 IF BUTTON_PRESSED THEN8 STRINGLN The button was detected! Breaking the loop.9 BREAK10 END_IF11 12 REM Do some work while waiting13 STRING .14 DELAY 100015END_LOOP