Re: still on that voice over suite
Re: still on that voice over suite
- Subject: Re: still on that voice over suite
- From: Axel Luttgens <email@hidden>
- Date: Thu, 1 Jul 2010 16:53:47 +0200
Le 1 juil. 2010 à 07:49:17, Yuma Antoine Decaux a écrit :
> Hi list,
>
> Im still trying to use the voice over suite properly, or tring to understand it.
>
> In my library i've set viewing the hierarchy of classes and objects and so far no compile error but the script doesn't do what i want it to.
>
> I've set some say commands to see where it blocks and it seems obvjous where, but i don't know why.
>
> Here is the script
>
> say "dragging the loop"
> tell application "System Events"
> set TrackTImeline to scroll area 2 of window 1
> tell application "VoiceOver"
> press mouse cursor object
> delay 1
> say "pressed"
> move vo cursor object to TrackTImeline
> delay 1
> say "moved"
> release mouse cursor object
> end tell
> end tell
> delay 1
> say "Drag successfull"
Hello Yuma,
Nice to hear from you again. ;-)
Above code tends to mix two very differing things: VoiceOver as a scriptable application, and System Events (with its Processes Suite) as a way to inspect and possibly act upon UI elements of application processes.
When an application say, GarageBand, is launched and while it is running, it builds various structures into memory so as to display windows, buttons, menus... This gives System Events the opportunity to inspect those structures, to translate them according to a given AppleScript model, and to make them available to others, e.g. thru AppleScript scripts.
For example:
tell application "System Events"
tell application process "GarageBand"
scroll area 2 of window 1
end tell
end tell
--> scroll area 2 of window "Mon morceau.band" of application process "GarageBand" of application "System Events"
Note that the returned value ultimately refers to System Events; that is, most of the time, only System Events will be able to "understand" that value and to directly make some use of it.
Unless one asks System Events to return some more universal value, for example:
tell application "System Events"
tell application process "GarageBand"
position of scroll area 2 of window 1
end tell
end tell
--> {503, 134}
Here, one gets a list of two integers, that is, a basic AppleScript construct.
On the other hand, VoiceOver is a scriptable application that provides an AppleScript model for things such as the mouse cursor, the vo cursor, the braille panel... The purpose of that model is to allow to script some actions related to the Voice Over system, for example as if one were pressing some VO key combo.
But strictly speaking, the objects managed/provided by VoiceOver are understood by VoiceOver itself, the same way the objects provided by System Events are useable within System Events.
As a result, when writing:
move vo cursor to TrackTImeline
you in fact are asking VoiceOver to move its vo cursor object towards an unintelligible (from VoiceOver's point of view) System Events' object.
> I've looked into Hui scripting chapter on applescript missing manual, and it mentions using system events for the scrit to recognize any UI elements such as scroll areas and windows etc.
>
> So i've added them but script just seems to block once mouse cursor object press is used....
>
> Has anyone got any doc or info pertaining to the voice over suite?
The only doc I could ever find is VoiceOver's dictionary itself. :-(
Let's first have a look at what it says about the vo cursor: it appears as property of the VoiceOver application, that property returning a vo cursor object.
Somewhere else in the dictionary, one may find the entry for the vo cursor object:
vo cursor object n, pl vo cursor object : The VoiceOver cursor
properties
bounds (rectangle, r/o) : The bounds of the VoiceOver cursor
text under cursor (text, r/o) : The text of the item in the VoiceOver cursor
magnification (real) : The magnification factor of the VoiceOver cursor
responds to
grab screenshot, move, perform action, select.
So, it seems that it understands a move command; let's have a look:
move v : Move the vo cursor to a new location.
move [up/down/left/right or into item/out of item] : The direction
to move in.
[to dock/desktop/menubar/menu extras/spotlight/linked item/
first item/last item] : The place to move to
Clearly, the vo cursor can't be moved to arbitrary places; in fact, that's quite logical, since the vo cursor is that artefact with a thick black border that may be moved at places provided by the target application (e.g. GarageBand) or the system.
Moreover, it seems that those moves are limited to a subset of what can be achieved with VO key combos; for example, "move to desktop" seems to be equivalent to VO+Shift+D.
As a result, even if VoiceOver would have been able to understand an object provided by System Events (very, very unlikely), its scripting model wouldn't anyway have allowed to move the vo cursor towards that object.
But the dictionary tells that the VoiceOver application has a mouse cursor property as well, that property returning a mouse cursor object:
mouse cursor object n : The mouse cursor
properties
position (point) : Position of the mouse
responds to
click, press, release.
So, the mouse cursor may be pressed and released by script, as you did above.
Moreover, it has a position property that seems to be settable (it isn't marked as r/o).
Let's have a look:
tell application "VoiceOver"
properties of mouse cursor
end tell
--> {class:mouse cursor object, position:{319, 144}}
Fine; the point is just the usual list of two integer coordinates.
Unfortunately, there seems to be a problem:
tell application "VoiceOver"
set position of mouse cursor to {10, 10}
end tell
--> error "Erreur dans VoiceOver : Il est impossible de régler position of mouse cursor à {10, 10}." number -10006 from position of mouse cursor
In fact, there's a terminology problem that still persist under 10.6.4.
But see my message "VoiceOver and the mouse cursor - slight bug and workaround", dated June 15th.
With that workaround and the ability to fetch the position of a UI element (as provided by System Events), it is possible to script drag and drop operations.
Unfortunately, it seems that GarageBand's loops are very bad citizens, and I'm still struggling with them...
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden