• 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: Scripting system preferences in OS X 10.2.3 (Christian Boyce)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting system preferences in OS X 10.2.3 (Christian Boyce)


  • Subject: Re: Scripting system preferences in OS X 10.2.3 (Christian Boyce)
  • From: Paul Skinner <email@hidden>
  • Date: Tue, 31 Dec 2002 10:22:09 -0500

This post is certified to be non-confrontational and criticism-free. It is a expression of a personal opinion and any attempt to read between the lines may be in violation of the DMCA.

On Monday, December 30, 2002, at 01:43 AM, Christian Boyce wrote:

I am particularly interested in scripting the Sound level and the Display brightness.
snip

So, I can SET volume, though I don't understand the range, but I can't figure out how to GET volume, and I can neither get nor set the display's brightness. Can someone point me in the right direction? What should I be aiming at, System Events or System Preferences or > ...?

System Events is an option, so I'll assume your client is on OS X.

Christian Boyce

Setting the display brightness and getting the sound level aren't available to AppleScript as far as I recall. So you can decide whether to use a third party OSAX or app, plist parsing or Apple System Events beta solution. If you post the same question with a specific method listed I'd bet you get an appropriate solution posted. Any unjustified or even loosely justified constraint may render your post a source of tangental replies that are of no use to your original purpose. ; )

On Tuesday, December 31, 2002, at 03:18 AM, Christian Boyce wrote:

On Monday, December 30, 2002, at 03:18 PM, Sander Tekelenburg <email@hidden> wrote


I'd like to do this without resorting to scripting the GUI, for
portability reasons.

Which porrtability reasons you are referring to?

It has been pointed out (after I asked specifically ;)) that the current GUI
scripting is to be considered a public beta, planned to end up in the main OS
itself. The only other portability issue (I think) would be localized OS X
versions, but as I understand it you can refer to menu items by index number.
(See Chris Espinosa's message of December 21, in the thread "uh, that's so
cool! AS 1.9.1")

If I write a script today that relies on the GUI-scripting public beta I can be pretty sure that it will not work for most people, at least not until the GUI scripting is a part of the standard OS X installation, and even then it will be awhile as not everyone is going to be up-to-date.

Yep. That's Beta.
I submit three suppositions in relation to this 'largest user installed base' issue.
1. Everyone will never be up to date.
2.Those users who don't keep their OS up to date also don't play around with downloadable AppleScript projects very often. In fact the majority of legacy OS macs out their will run their current OS and software without any change until their power supplies fail.
3. The number of users on OS X is expanding faster than that of users running OS<X. Do the extrapolation.

In my own office I have a fellow who is ordinarily very quick to update to the very latest version of any program, but he is not an AppleScripter and thus will not be likely to be aware of the GUI-scripting stuff. So, if I write a script for him I have to also install stuff for him-- not very portable if I have to first install stuff on his machine.

Regardless, it would be nice to be able to actually "get" and "set" brightness of the monitor, and the sound level. And, can anyone explain why sound levels aren't integers from 0 to 7 anymore? I was astounded to be able to set the sound level to 0.15.


They were never limited to integers. You could always spec a volume as a real from 0 to 7.
If you'll watch your sound control panel you'll see that any value over 7 sets the volume to it's highest setting(1). If you try .1, .2, .4, .8, 1.6, 3.2 for your value you'll also note that it is a decibel based scale.



Regarding the GUI stuff, how does one figure out the index numbers for buttons, pop-ups, etc.? How do I know that I'm trying to click button 3, say, and not button 4?
--
Christian Boyce

I think Paul B. answered this query very well


One thing that hasn't been pointed out is that we are seeing the birth of a new age for AppleScript. One in which every application will be fully scriptable, recordable and probably fully attatchable. The largest obstacle to AppleScript's widespread adoption has been the lack of implementation by third party vendors (2). Now every cocoa application will give it's author an AppleScript interface without any additional effort (3).

People seem frequently upset by the changes that are happening within Apple recently. Changes in AppleScript and the OS are rapid, frequent and profound. This is not the easiest time to be a developer on this platform. But I see it as something akin to plowing a field. Everything is in flux. No one can expect all their seeds to survive if they plant them now. But Steve and co. are preparing for spring.

Apple could have had a team of engineers working diligently to add a second interface (AppleScript) to every control panel and been able to deliver many of them by this time, but by having them work to make the entire cocoa GUI addressable they can basically create an AppleScript interface for all apps (4) simultaneously. I don't think that this is just a replacement for QK. This is the tip of the iceberg of AppleScript becoming a fully featured core technology for Apple.

I have one foot in the past with legacy boxes as old as 8500's in the office and apps that are crucial that are never going to be updated to OS X compatability. But I won't invest one more minute in code or apps that don't look to the future.
OS X may not have the installed base, every feature, every app or even the speed of OS <X but it's being seriously, enthusiastically and constantly improved upon by Apple, many third parties, and those on this list! My thanks to all of the above! Soon AppleScript will truly be a peer to Aqua. Think about that and remember the days when getting a bug fix was reason for celebration.


(1) Well the GUI slider doesn't quite make it all the way to the edge of the scale, but I hear no increase in volume with that final nudge, so I assume that the GUI is indicating the lower limit of the slider for full volume setting.

(2) I know! This is open for debate. Consistency in implementation is a contender. Apple's own sloth in implementing AppleScript in it's own apps and OS are an issue too, but the third party apps really drive the economics.

(3)Not that this indirect AS implementation is optimal, Nor that the developer can't and won't make it awful or difficult to use through their design.

(4)Cocoa that is. Just as 68k code is today, so will be all non-Cocoa apps in the future.

--
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Scripting system preferences in OS X 10.2.3 (Christian Boyce) (From: Christian Boyce <email@hidden>)

  • Prev by Date: Re: GUI Scripting: Text fields and areas
  • Next by Date: RE: EPS information
  • Previous by thread: Re: Scripting system preferences in OS X 10.2.3 (Christian Boyce)
  • Next by thread: GUI Scripting: Text fields and areas
  • Index(es):
    • Date
    • Thread