AppleScript without showing what program it opened and edited
Not directly. You would have to figure out what underlying preferences the UI is changing, and whether there was a way to edit them directly using AppleScript or terminal commands (such as defaults write -- see man defaults for details.)

Unfortunately there is no canonical list of preferences that can be edited in this way, although you can find some here. There is also a website dedicated to hidden preference tweaks for OS X and Mac applications: defaults-write.com.

However, for your particular case, I'm pretty sure there is no built-in way to change resolutions from the command line. There is a screenresolution command that somebody wrote a few years ago, but it doesn't seem to work well with retina resolutions.