• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How Do I - Click 'OK' in a dialog - Excel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How Do I - Click 'OK' in a dialog - Excel


  • Subject: How Do I - Click 'OK' in a dialog - Excel
  • From: brian <email@hidden>
  • Date: Tue, 7 Jun 2005 19:25:39 -0400

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
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How Do I - Click 'OK' in a dialog - Excel
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Intel = no change for scripters?
  • Next by Date: Re: Intel = no change for scripters?
  • Previous by thread: Re: Intel = no change for scripters?
  • Next by thread: Re: How Do I - Click 'OK' in a dialog - Excel
  • Index(es):
    • Date
    • Thread