• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pref. pane (need more help)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pref. pane (need more help)


  • Subject: Re: Pref. pane (need more help)
  • From: kai <email@hidden>
  • Date: Sat, 26 Mar 2005 13:56:49 +0000


On Sat, 26 Mar 2005 07:35:47 +0100, Bernard Azancot wrote:

Thanks a lot, Bob and Kai.

On a french system, the 2 tabs are respectively labelled "Monitor" and "Couleur".

That seems sensible enough.

2 "naive" additional questions:
- when I open the pane the default tab is "Display". So why bother with tabs ?

Beware the unpredictability of the user, Bernard... ;-)

You're right, of course. When System Preferences is first opened and the Monitors/Displays panel is selected, the "Monitor"/"Display" tab is selected by default. However, if the user selects the "Couleur"/"Color" tab, and then fails to quit System Preferences, that tab remains selected - even when another panel is displayed. So when the script reopens the Monitors/Displays panel, it won't be able to find the brightness slider - because the wrong tab group will be showing. Clicking the "Monitor"/"Display" tab is really just a precaution to avoid such an eventuality.

- is it possible to prevent the script from opening the pane to do ist job ?

Another good question - to which the answer is yes. Again, the user could bring about such a condition - by closing the System Preferences window without quitting. Although *application* "System Preferences" may be aware of any hidden windows, *process* "System Preferences" only recognises and works with visible ones. So, for the GUI part of the script to work, a window must be visible.


To deal with the possibility of a missing/invisible System Preferences window, I sometimes include an application run command before the required panel is selected. If the window is already visible, this command is (to all intents and purposes) ignored. Since some GUI elements can be controlled without making the target the frontmost application (as is the case with the scripts we are discussing), the run command can often replace the activate command. So, to make your script even more watertight, you could start it like this:

----------------

tell application "System Preferences"
	run
	set current pane to pane "com.apple.preference.displays"
end tell

-- continue with the rest of the script

----------------

---
kai

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Pref. pane (need more help)
  • Next by Date: Tiff/Jpeg image as dialog box backdrop?
  • Previous by thread: Re: Pref. pane (need more help)
  • Next by thread: Issue with AS variable in OS 10.2
  • Index(es):
    • Date
    • Thread