Control of apps while driving. (Macros?)
Tasker can do that (and a lot more things), as long as the app in question supports it (a list of apps with Tasker support can e.g. be found here − never mind the German, if you're just after the list). As you've described, it supports "Shake gestures", and if your device has a camera button, you could utilize that as well. "Flip gestures" might also come in handy (flip the device to face down, then face up, etc.)

I know it's a paid app. But to try it out, visit the app's project site and get a 7-day trial (remember to export all your configuration and profiles before "day 7", then you can simply uninstall, re-install, and re-import your settings for another 7 days period − this hint comes from the dev himself, so it's nothing bad ;)

The app needs some time to get warm with it. But once you did, you don't want to miss it anymore :)