Panic Button
(command-line utility)

This utility is for a silly gadget called the Panic Button. It looks like something that launches a nuke strike, but it's really just a USB boss key: it hides the game on your screen when your boss comes by. The app included with the gadget is very basic: it can only show images. My panic.exe will launch any command, e.g. start a backup job. The code is based on Project Megasnake.
panic.ini
panic.exe keeps its parameters in a file called panic.ini, located in the same folder as the exe. A sample panic.ini :
1000
start C:\mybackup.bat
The first line sets the polling frequency in miliseconds. This is how often panic.exe will check the state of the Panic Button. Lower value=more CPU usage. If you need quick reaction time, use 10-50 ms. If delayed reaction is not an issue (e.g, for a backup job), use several seconds (1000-5000). |
The second line specifies the command to be run when the Panic Button is pressed. Specify it as you would on the command line. |
You can also list an alternate command. If you press the Panic Button once, the first command will run. If you press the Panic Button again within 3 seconds (a "double-click"), the alternate command will run.
1000
start C:\mybackup.bat
start C:\shutdown.bat
At the start of the 3 second period you'll see the dialog below. It may take some time for the dialog to appear if your polling frequency is set high.

Download
Download panic.zip (12K)