This is my 2nd attempt at AppleScript.
I am trying to write a simple AppleScript for Apple’s Address Book. I wanted the printed list of addresses to be separated by a page break so that I could easily insert tab pages for each letter of the alphabet to make a finished booklet. It seemed like an easy project at the start.
I can select the specific letter (and the people I want to print) but I cannot control the specific fields that are printed on the “Print” Window. Here’s the output from Apple’s UI Element Inspector for the “Phone” (the first entry of a scrolling list of check boxes labeled “Attributes” on the “Print” Window).
<AXApplication: “Address Book”>
<AXWindow: “Print”>
<AXCheckBox: “Phone”>
Attributes:
AXRole: “AXCheckBox”
AXRoleDescription: “check box”
AXHelp: “(null)”
AXValue: “1”
AXEnabled: “1”
AXFocused (W): “0”
AXParent: “”
AXWindow: “<AXWindow: “Print”>”
AXTopLevelUIElement: “<AXWindow: “Print”>”
AXPosition: “x=782 y=319”
AXSize: “w=196 h=19”
AXTitle: “Phone”
Actions:
AXPress - press
There’s a clear upward path from “Phone” to “Print” Window. However when I look down the path from the “Print” Window the path is not so clear.
<AXApplication: “Address Book”>
<AXWindow: “Print”>
Attributes:
AXRole: “AXWindow”
AXRoleDescription: “dialog”
AXSubrole: “AXDialog”
AXChildren: “<array of size 7>”
AXParent: “<AXApplication: “Address Book”>”
AXTitle: “Print”
AXSize: “w=893 h=550”
AXPosition (W): “x=214 y=81”
AXMain (W): “1”
AXMinimized: “0”
AXTitleUIElement: “”
AXDefaultButton: “<AXButton: “Print”>”
AXCancelButton: “<AXButton: “Cancel”>”
Actions:
AXRaise - raise
There are 7 items for children: 1 AXStaticText and 6 AXUnknowns. I can highlight the AXUnknowns and find what they control. But if I follow the 6th (UI Element 7) it leads to further unknowns and never to any item I can see in the upward path of “Phone”.
Am I just looking at some quirky programming within Apple’s Address Book that makes the check boxes I’m interested in unscriptable? Or can one specify a clear path in AppleScript to check (or uncheck) the boxes that control which fields are printed?