Run onboard script automatically after disconnecting from computer

I have a H7+ board, powered by a Li-ion battery, inside a box that should not be opened. The box has a USB connector so that from time to time, I can connect the board with a computer to retrieve data, check the live view, etc.
However, after I disconnect the USB cable from the box, I would like the board to revert to restart to run the onboard script (currently it does nothing, although it is powered by the battery). Is there a trick to do this? Otherwise, I need a switch outside the box.

The IDE stops script execution when it connects and the script is left running once usb is removed.

So, if you want to restart your you can do this from the IDE before removing the usb connector.

Alternatively, hack the firmware to make it do what you want.

Excellent, this device behavior is great news for us!

So, to clarify, as I had to try out a few combinations: the key is to NOT stop the script and NOT disconnect the camera from the IDE and NOT shut down the IDE (slightly weird for people who like to neatly stop, close and disconnect things).
Then the board will continue running that script (that was presumably stored on the cam) with the battery power entering through the PH2.0 connector. Soft-ejecting the camera from the computer did not change this behavior (can be done if desired).

You can just unplug the camera from the IDE when the script is running and the script will keep running.