Select Dashboard widgets via Applescript?

I’d like to use Applescript to open Dashboard and select a widget (Calculator, specifically), so that it will be ready to receive input.

Is this possible? I searched but found only a thread where someone posted the question and then thanked another user for providing the answer ” but there’s no post from that user in the thread. So I think it must be possible, somehow …

Any help would be most appreciated!

Dashboard does not have a scripting dictionary so you would have to GUI script through System Events, being Dashboard I wouldn’t know how.

Great advice ” the hunt is on. Accessibility Inspector has this to tell me about the Calculator widget:

[code]<AXApplication: “Widgets Unit Converter iCal.wdgt CharacterPal.wdgt Translation C…”>
<AXWindow: “Calculator”>

AXRole: “AXWindow”
AXRoleDescription: “AXWindow:AXUnknown”
AXSubrole: “AXUnknown”
AXTitle: “Calculator”
AXFocused: “false”
AXParent: “<AXApplication: “Widgets Unit Converter iCal.wdgt CharacterPal.wdgt Translation C…”>”
AXChildren: “<array of size 1>”
AXPosition (W): “x=1267 y=18”
AXSize: “w=172 h=248”
AXMain (W): “false”
AXMinimized: “false”
AXCloseButton: “(null)”
AXZoomButton: “(null)”
AXMinimizeButton: “(null)”
AXToolbarButton: “(null)”
AXProxy: “(null)”
AXTitleUIElement: “(null)”
AXGrowArea: “(null)”
AXDefaultButton: “(null)”
AXCancelButton: “(null)”
AXDocument: “(null)”
AXModal: “false”

AXRaise - raise
AXCloseWidget - close widget

No verification data for role AXWindow with subrole AXUnknown.
AXCloseWidget: Unexpected extra action

Optional Attributes:
The output is identical regardless of whether the widget is the currently active one or not. (I would have thought that AXFocused would have been “true” in the former case.) Still, I hold out hope that AXRaise will do what I want, and I guess a click on the calculator readout also would. In fact, I know nothing about GUI Scripting, but that can change.

But the application name! Widgets Unit Converter iCal.wdgt CharacterPal.wdgt Translation C. is actually short for Widgets Unit Converter iCal.wdgt CharacterPal.wdgt Translation Calculator Weather Stickies Stickies Stickies Stickies Stickies Stickies Stickies World Clock World Clock [gasp for breath]. In other words, it’s the word Widgets followed by a list of all the widgets presently on my Dashboard.

What do I do with that? I’d hate to have the script stop working every time I opened another World Clock or closed a Stickies widget.

I tried the PreFab UI Browser application, which is advertised as a tool to help with GUI Scripting. It identified the UI elements as belonging to DashboardClient and listed AXApplication as Widget Calculator. But Applescript’s never heard of that application. So ” hrm.