Reset display with AppleScript
2009-04-27 - mac os x, xserve, remote desktop
I've had some problems with a Xserve having a garbled screen (see image) when I log in to it, and since there is no monitor connected, there are no tricks for pressing "detect display" to use for resetting the display. And I'm using it blindly as well, so I needed a way to do it from the terminal. So I put together the below AppleScript that fixes the issue for me.
tell application "System Preferences" activate set current pane to pane "" end tell tell application "System Events" tell process "System Preferences" select row 1 of table 1 of scroll area 1 of group 1 of tab group 1 of window "Displays" end tell end tell
Basically, all it does is open the system preferences and selects the smallest resolution (the first in the list) which makes the system reset the display and fix the screen. Save this script as an application on the remote machine and run it with "./" from the terminal.
Hopefully this will help someone that was having the same problem as me.

For this to work, you need to make sure of this:

  • Enable System PreferencesUniversal AccessEnable access for assistive devices
  • Make sure the AppleScript doesn't show a startup dialog
Mer i Tutorials
Skapa snyggare tooltips med jQuery
Snyggare fdelsedagar i iCal och iPhoneiPod touch
Uppdaterad video Nya layoutmodulen
Reset display with AppleScript
Expos  Stickies
Bygg MySQLqueries automatiskt
Mail Processing
Nyckelord: mac os x, xserve eller remote desktop
vad gr man om man har en Xserve ver
Korkade amerikaner
Raid installerad
Xserve RAID har kommit
Leoparden frsenad
P torsdag gller det
Nya servarna p plats
1/20 DeLorean Time Machine
Caso Outdoor Cooler
Minikyl Coca Cola
Verktygsvagn med verktyg, 161 delar
CSS filters for background images
Huset ommålat!
Skiss för tatuering
Spelbordet klart
Laser cutting my Myst Island
We Can Do It
Skaffat husbil
Foton på bilen
Remarkable 2
Ny espressomaskin!
Porträtt av Emma
AtlasCMS och rådande krissituation
Ny bil! Ford Mustang Mach-E GT
Spelbordet, igen
Ny bil beställd
Två månader med Keto
Spelbord v3
Mechanical Age map
More shading and water
Första månaden med Keto
Fotosession: Tabitha
Måla om huset
Byggt hylla till vintunnorna
Dodge RAM
Drömmen om ett spa
Dags för carport
Survey Island, what is happening?
Gillestugan uppdaterad!
Spelbord v2
Tre billyhyllor blir två
You can't take the sky from me
Högtalare klara! tar ned skylten
Högtalare bestämda!
Uppgraderingar biorum
Lord of the Rings-maraton
Ergonomiskt som tusan!