Hoppa direkt till innehåll

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.
detect_displays
tell application "System Preferences" activate set current pane to pane "com.apple.preference.displays" 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 "./detect_displays.app" 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
Recension: Steam Hotell
Rostfärg och IKEA-lampa
Create a physical book from my digital book
Survey Island
Someone is trying to sell my map!
Julkalender
Myst book updated
Recension: Yasuragi Ryokan Hanare
Recension: Ad Astra
Ny tatuering - midgårdsormen!
Minnestal till en kaffekopp
Förlovade
Sweden Rock 2023
Ny nummerskylt för huset
Fix i husbilen
Grubbelgubbe
Måla med rostfärg
Vårfix i trädgården
Jung Kook
Pappaskämt och annan humor
Bilder på spelbordet när det används
Använda laserskäraren för att skapa innehål...
Julklappar med laserskärare
Budget-Spa
Nyckelskåp
Fjällkaffe
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
Batwing
Elsa
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