Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Switch Displays w/ Applescript
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="photon43" data-source="post: 1066869" data-attributes="member: 161771"><p>This is one of those things that I think should be really easy to do but for some reason I can't find any useful info on it.</p><p></p><p>I have one of the new iMac 21" models and a 42" HDTV mounted above it - great for movies and a general media center. Now, when I want to watch a movie I have to do several things to prep for this:</p><p></p><p>1) Open system prefs and switch the main display to the top 42" screen.</p><p>2) Open the desktop and screen saver pane and set the desktop BG to solid black for the lower screen (b/c there is no way to shut it off and having it any other color is distracting during a movie)</p><p></p><p>Now, none of this is particularly annoying really, But… It does take like 7 or more clicks to get it done.</p><p></p><p>I would like to automate the whole process of course - b/c I should be able to, there is just no reason why not. I want to run a script that switches the desktop from bottom to top monitor, changes the desktop BG from gray to black at the bottom monitor (the iMac) and then have another script that does this all in reverse (more on this idea below) for when I need to get back to work. It really does not seem like such a tall order but I can find no answers anywhere.</p><p></p><p>The following script is the best I could find (I did not write this - just modified the paths a bit) but all it does is change the BG of the desktop:</p><p></p><p>set buttonList to {"work", "movies"}</p><p>set colorList to {"Solid Gray Medium", "Solid Black"}</p><p>display dialog "Which environment?" buttons buttonList default button 1</p><p>set selectedButton to the button returned of the result</p><p></p><p>repeat with index from 1 to 3</p><p>if item index of buttonList = selectedButton then exit repeat</p><p>end repeat</p><p></p><p>set selectedColor to item index of colorList</p><p></p><p>tell application "Finder"</p><p>set desktop picture to {"BobaFett4:Libraryesktop Pictures:Solid Colors:" & selectedColor & ".png"} as alias</p><p>end tell</p><p></p><p>I need it to go a bit further but this is perfect because it eliminates the need for the 'reverse' script I was talking about before because of the buttons it gives me. I could just switch between the two sates (work and movies) at will if I could get some code that would take care of the main display switch along with the BG color switch. But I cant figure out how to take this to the next level. Please help if you can. Thanks!</p></blockquote><p></p>
[QUOTE="photon43, post: 1066869, member: 161771"] This is one of those things that I think should be really easy to do but for some reason I can't find any useful info on it. I have one of the new iMac 21" models and a 42" HDTV mounted above it - great for movies and a general media center. Now, when I want to watch a movie I have to do several things to prep for this: 1) Open system prefs and switch the main display to the top 42" screen. 2) Open the desktop and screen saver pane and set the desktop BG to solid black for the lower screen (b/c there is no way to shut it off and having it any other color is distracting during a movie) Now, none of this is particularly annoying really, But… It does take like 7 or more clicks to get it done. I would like to automate the whole process of course - b/c I should be able to, there is just no reason why not. I want to run a script that switches the desktop from bottom to top monitor, changes the desktop BG from gray to black at the bottom monitor (the iMac) and then have another script that does this all in reverse (more on this idea below) for when I need to get back to work. It really does not seem like such a tall order but I can find no answers anywhere. The following script is the best I could find (I did not write this - just modified the paths a bit) but all it does is change the BG of the desktop: set buttonList to {"work", "movies"} set colorList to {"Solid Gray Medium", "Solid Black"} display dialog "Which environment?" buttons buttonList default button 1 set selectedButton to the button returned of the result repeat with index from 1 to 3 if item index of buttonList = selectedButton then exit repeat end repeat set selectedColor to item index of colorList tell application "Finder" set desktop picture to {"BobaFett4:Libraryesktop Pictures:Solid Colors:" & selectedColor & ".png"} as alias end tell I need it to go a bit further but this is perfect because it eliminates the need for the 'reverse' script I was talking about before because of the buttons it gives me. I could just switch between the two sates (work and movies) at will if I could get some code that would take care of the main display switch along with the BG color switch. But I cant figure out how to take this to the next level. Please help if you can. Thanks! [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Switch Displays w/ Applescript
Top