apple script can move all of your windows to main display
So I just got home from doing a bit of coding at my favorite coffee shop. I probably have 25-30 application windows open right now and as soon as I plug into my external display I will have to readjust all 30 windows. The problem is that when I am just using my MacBook Pro I like to have all of my app’s windows on that display… obviously! But when I come home and plug into my external display I no longer want my windows open in the MacBook Pro’s 15″ display, I want them open on my 24″ display. So for the past year I have manually dragged each application over to my large display. I estimate that I have wasted 4-5 hours in the past couple of months. I will not do the machines work any longer! Enter this script and you will add hours to your life!! I am really surprised that Apple has not addressed this issue.
tell application "System Preferences" set current pane to pane id "com.apple.preference.displays" reveal (first anchor of current pane whose name is "displaysArrangementTab") tell application "System Events" to tell process "System Preferences" set frontmost to true click checkbox "Mirror displays" of group 1 of tab group 1 of front window end tell set current pane to pane id "com.apple.preference.displays" reveal (first anchor of current pane whose name is "displaysArrangementTab") tell application "System Events" to tell process "System Preferences" set frontmost to true click checkbox "Mirror displays" of group 1 of tab group 1 of front window end tell end tell quit


