Re: Can't turn off screen savers in System Preferences
Re: Can't turn off screen savers in System Preferences
- Subject: Re: Can't turn off screen savers in System Preferences
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 06 Oct 2006 07:50:41 -0400
- Thread-topic: Can't turn off screen savers in System Preferences
on 2006-10-05 9:20 PM, deivy petrescu at email@hidden wrote:
> I've also noted that the slider moves by 60. 0 being "3" minutes and
> 360 being "Never".
That isn't quite right here. If you 'get' the value of the slider after
manually setting it to Never, the value is 361, not 360. And the AXMaxValue
attribute of the slider is always given as 361 when you examine it with UI
Browser or Accessibility Inspector.
The AXMinValue attribute is given as 1, and manually using the slider you
can only go as low as 3 minutes, which returns a value of 1. Similarly,
using UI Browser's Attributes drawer to set the value to 1 moves the thumb
to the 3-minute mark.
The 5-minute detent has a value of 60; 15-minute, 120; 30-minute, 180; and
so on. Sort of a logarithmic scale.
Interestingly, you can never get the thumb to stop right on the 2-hour
detent, whether manually or with UI Browser or GUI Scripting. Instead, it
snaps to a value of 240, which is visually just to the left of the detent.
Apparently, the 2 hour detent is conceptually a value of 241.
In summary, all of the detents obey the relation (detentvalue mod 60 = 0),
except that the 3-minute mark, the illegal 2-hour mark, and the Never mark
obey (detentvalue mod 60 = 1).
When dragging the thumb manually, I noticed for the first time this morning
that there is a subtle "snap" effect as you move towards or away from each
marked value, making it feel like a detent in a physical slider. I noticed
it first when trying to drag to the 2-hour detent. In fact, however, I now
see that the snap effect kicks in very close to each of the detents.
However, between 2 hours and 3 hours you can't drag it to any intermediate
value at all. I don't see a similar snap effect in any of the other sliders
in System Preferences that I tried, so it was apparently coded specifically
for this one slider. I'll wager that this snap effect is the source of the
bug causing the value to fail to stick when set using the accessibility API
(both GUI Scripting and UI Browser), as described in the remainder of this
message:
You can set the value to intermediate values between the detents using UI
Browser or GUI Scripting, and by dragging or clicking, except for several
very interesting prohibited ranges.
You can't set any value between 241 and 360, inclusive. UI Browser gives a
range error; GUI Scripting, manually dragging and manually clicking snaps it
to 240 or 361. You also cannot set the value to any number below 10, other
than 1. The values 2 though 9 generate an out of range error In UI Browser,
while in GUI Scripting and manual use they snap the value to 1 or 10. Each
of the other "snap" zones seems to be unsettable by any means, as well.
My guess is that whoever coded this slider got way too clever with the snap
effect. The effect is apparently implemented by hard coding several
prohibited value ranges or "dead zones." That's fine for manual control --
this slider exhibits Apple's traditional attention to UI finesse. However,
the technique chosen -- the dead zones -- makes it confusing to the scripter
and the accessibility API. GUI Scripting does "the right thing," snapping
the value to the nearest legal value just like the manual UI. UI Browser,
which doubles as an accessibility API tool for developers, reports the dead
zones as an out-of-range error; this is correct from the point of view of
the accessibility API, although in out-of-range situations beyond either end
of a valid range I coded UI Browser to snap to the nearest legal value
(while still presenting an error alert for the benefit of accessibility
developers).
Finally, using UI Browser's Attributes drawer to set the value to any legal
value also fails to stick when you quit System Preferences and restart it.
Since GUI Scripting and UI Browser use essentially the same accessibility
API code under the hood, this establishes that the bug lies in the
implementation of accessibility support in this slider. I would guess that
the complexities of this dead zone implementation of the snap effect led the
programmer who made this slider accessible to an error which causes the
value to fail to stick in response to accessibility commands.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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