change screen resolution with AppleScript
We have created a python script, called Display Manager that allows you programmatically set resolution, bit depth, underscan, mirroring, etc.

Give it a try and let us know if you want additional functionality

https://github.com/univ-of-utah-marriott-library-apple/display_manager