Thought this would be simple. Does Apple include a way to objectively control the UI What i want to do is delete a worksheet from an Excel workbook [see code below] problem I have is it pops up a dialog box and I do not know how to tell it OK, or to just do what i want without prompting. If I use UIElemntInspector on the button, I get the following
<AXApplication: “Excel”> <AXWindow> <AXButton: “OK”> Attributes: AXRole: “AXButton” AXRoleDescription: “button” AXParent: “<AXWindow>” AXTitle: “OK” AXWindow: “<AXWindow>” AXTopLevelUIElement: “<AXWindow>” AXPosition: “x=854 y=496” AXSize: “w=69 h=20” AXEnabled: “1” AXFocused (W): “0” Actions: AXPress - press
I can do something like
tell application "Microsoft Excel" activate -- delete worksheet "Deposits" tell application "System Events" tell process "Excel" click menu item "Delete Sheet" of menu "Edit" of menu bar 1 click button "OK" of window end tell end tell end tell
I get one of two errors depending on how the click button line is done Can't get button "OK" of window. or "System Events got an error: NSReceiverEvaluationScriptError: 4" thanks for any help in advance. maybe i can help some of you sometime.
brian |