Hi All,
I have a need to be able to set the focus of a window using UI scripting. The window is similar to iTunes in the fact that it has a list section at the left and then a main area to the right. I have scripting that brings the window to the front but if the window’s focus is not in the right section the script doesn’t work correctly. The app remembers where the last focus was for that window. Here is info for the left section of the window from UI Element Inspector
<AXApplication: “Capture One PRO”>
<AXWindow: “Captures”>
Attributes:
AXRole: “AXTable”
AXRoleDescription: “table”
AXHelp: “(null)”
AXFocused (W): “1”
AXParent: “”
AXChildren: “<array of size 9>”
AXWindow: “<AXWindow: “Captures”>”
AXTopLevelUIElement: “<AXWindow: “Captures”>”
AXPosition: “x=14 y=129”
AXSize: “w=236 h=765”
AXEnabled: “1”
AXRows: “<array of size 6>”
AXVisibleRows: “<array of size 6>”
AXSelectedRows (W): “<array of size 1>”
AXColumns: “<array of size 3>”
AXVisibleColumns: “<array of size 3>”
AXSelectedColumns: “<array of size 0>”
AXHeader: “(null)”
Actions:
AXShowMenu - show menu
The part of the window that I need to be sure is in focus has this info.
<AXApplication: “Capture One PRO”>
<AXWindow: “Captures”>
Attributes:
AXRole: “AXScrollArea”
AXRoleDescription: “scroll area”
AXHelp: “(null)”
AXFocused (W): “0”
AXParent: “”
AXChildren: “<array of size 0>”
AXWindow: “<AXWindow: “Captures”>”
AXTopLevelUIElement: “<AXWindow: “Captures”>”
AXPosition: “x=278 y=84”
AXSize: “w=1643 h=1064”
AXHorizontalScrollBar: “(null)”
AXVerticalScrollBar: “(null)”
AXContents: “<array of size 0>”
The main difference that I see is the AXRoleDescription which is “table” for the left area and “scroll area” for the section that I need to set the focus to.
Here is a snip of my script
--Bring app to front
tell application "System Events" to tell process "Capture One PRO" to set frontmost to true
(* I need to set the focus to the correct part of the window here *)
--Switch to thumbnail view
tell application "System Events" to tell process "Capture One PRO" to keystroke "2" using command down
--Go to first image
tell application "System Events" to tell process "Capture One PRO" to key code 115 using command down
How can I set the focus of the window to the “scroll area”?
Any thoughts?
Thanks,
Mark
Model: G5 2.0gHz DualCore Power PC
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)