Jump to content

Applescript for Detect Displays


  • Please log in to reply
6 replies to this topic

#1
vizual.menace

vizual.menace

    InsanelyMac Protégé

  • Members
  • Pip
  • 42 posts
  • Gender:Male
I wrote a little script to detect displays for me that I just put in my login items so it does it automaticly on login. Hope it helps someone. Here is the script.

[codebox]tell application "System Preferences" to activate
delay 2
tell application "System Events"
tell process "System Preferences"
click menu item "Displays" of menu "View" of menu bar 1
delay 3
tell button "Detect Displays" of group 1 of tab group 1 of window "Display" to click
end tell
end tell[/codebox]

Edited by vizual.menace, 19 March 2007 - 02:48 AM.


#2
p1truman

p1truman

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 1 posts
Hi



Why does this script not work in osx 10.5.6 ?

Whats Changed ?

Many thanks in advance

P

#3
riws

riws

    InsanelyMac V.I.P.

  • Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 6,081 posts

Hi



Why does this script not work in osx 10.5.6 ?

Whats Changed ?

Many thanks in advance

P

It works fine in 10.5.6.

#4
ziorkon13

ziorkon13

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 1 posts
Hi

The script does not work for me in OSX 10.6.3

I got the error:

System Events got an error. Can't get button "Detect Displays" of group 1 of tab group1 of window "Display" of process "System Preferences".

Any idea what needs to be changed?

Many thanks in advance.

#5
vizual.menace

vizual.menace

    InsanelyMac Protégé

  • Members
  • Pip
  • 42 posts
  • Gender:Male
Have you tried adding a keyboard shortcut to do this

go to system preferences/keyboard/keyboard shortcuts

hit the plus sign

type in Detect Displays

Then add a shortcut


logout or restart and give it a try, i cant verify that this works!

let me know if not and i can write a new script

#6
Dell Inspiron 15

Dell Inspiron 15

    InsanelyMac Protégé

  • Members
  • Pip
  • 8 posts
works fine

#7
fess .

fess .

    InsanelyMac Protégé

  • Just Joined
  • Pip
  • 1 posts

The script does not work for me in OSX 10.6.3


didn't work for me in 10.6.4

I adjusted it, basically adjust the target for the click:

tell button "Detect Displays" of window 1 to click

here's the whole thing. this one also quits system prefs at the end, and I took out the delays. I didn't seem to need them.

tell application "System Preferences" to activate
tell application "System Events"
	tell process "System Preferences"
		click menu item "Displays" of menu "View" of menu bar 1
		tell button "Detect Displays" of window 1 to click
	end tell
end tell
tell application "System Preferences" to quit


P.S. thanks to the OP for rapidly leading me to a solution.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy