Ah! No need for using the shell here, it's just a simple (and hacky) applescript! But good stuff enabling Universal Access. Here's what you need to do
1. Copy the script (try Hal's script) 2. Open up Script Editor (or AppleScript Editor on 10.6) in your / Applications/Utilities folder 3. make a new script 4. Paste it in, & Compile it (Hammer Icon) 5. Save it anywhere you'd like (I have mine in /Users/(my username)/ Library/Scripts) 6. Make sure QS catalogs the location of the script 7. "Run" it from QS! And thanks for the "of window 1" tip Hal, it makes the script much more universal (I could have sworn I tried something like that and it didn't work, oh well) On Aug 25, 12:46 pm, lloyd <[email protected]> wrote: > Hey Hagure - thanks for the script (and for taking the time to make a > 10.5 variant). I would love to try it, but I'm sorry to say I don't > know what to do with a UI script. I found out I'll have to enable > Universal Access, but I don't know what to do with the script. I am > comfortable with the bash shell - where do I place the executable file > containing the script, once I've created it? And can I execute it by > having QS launch it? Sorry for my tedious questions. Thanks again. > > On Aug 24, 5:50 pm, Hagure <[email protected]> wrote: > > > > > > > > > Here's my version of the script, utilizing UI Scripting & the Displays > > Pref Pane (no need for the menubar item). You will have to update the > > window name inside the quotes of the line: (tell button "Detect > > Displays" of window "DELL SP2309W" to click). For example, my MBP's > > window name is the generic "Color LCD". > > > But sometimes this can be harder to find than you'd think; one of my > > old no-name monitors had a trailing space at the end of it's name. So > > while I typed in what I thought was the window name, I kept getting > > errors. I had to use a uielementinspector program (whose name escapes > > me at the moment) to find the actual name, with the "invisible" space. > > > Anyway, let me know if it works out for you! > > > CODE BELOW: > > ----------- > > > (* Use this instead if you're running 10.5 or lower > > > tell button "Detect Displays" of group 1 of tab group 1 of > > window > > "DELL SP2309W" to click > > *) > > 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 > > delay 3 > > tell button "Detect Displays" of window "DELL SP2309W" to > > click > > delay 3 > > end tell > > end tell > > > ignoring application responses > > tell application "System Preferences" to quit > > end ignoring > > > ---------- > > CODE ABOVE
