Yes, AppleScript did this way back in the pre-OS X days -- but only if you added Apple Events support to your app, which was extremely fiddly and tedious.
Their current tool Automator is supposed to do this, but I don't know how widely it's supported. I suspect just like everything else, it has niche of users who love it and depend on it. It's not something your typical Mac user would think to reach for.
Either way, I think log files of actions taken are much more debuggable than watching a computer control the gui.