There might be an easier way, but here's how I do it:
Step 1) Make an Attract Mode plugin
Save this as "CustomCommand.nut" or whatever, in Attract Mode's /plugins folder:
local cmd = "$HOME/.attract/screensaver/mame_screensaver.py";
fe.add_signal_handler( "custom_signal" )
function custom_signal( signal )
{
if ( signal == "custom5" ) // HARD CODED TO CUSTOM5!
{
print ("Running my script!!!!");
system( cmd );
}
}
Edit the "cmd" above to the path for your script. Also edit the "custom5" for whatever command you're using in Step 3 below.
Step 2) Enable the plugin
In Attract Mode, go to Plugins and find your newly created plugin (called "CustomCommand" in the example above) and enable it.
Step 3) Map a button to it
In Attract Mode, go to Controls and scroll down to the "custom" controls and click it to set whatever button you want to run it. In the example above you'd scroll down to Custom5 and then associate whatever button with it.
Now pressing that button should execute that AM plugin, which will launch your script.