When I open the .ods file in microsoft excel I would like to on the "Alert" dialog box click "Yes" with the apple script.

dialog box

I try like this, but not work :(

    set theWorkbookFile to choose file with prompt "Please select an Excel workbook file:"
set theWorkbookName to name of (info for theWorkbookFile)
tell application "Microsoft Excel"

    open theWorkbookFile
    delay 3
    tell application "System Events" to tell process "Microsoft Excel"
        click button "Tak" of dialog of application process "Microsoft Excel"
    end tell
    set theWorkbook to workbook theWorkbookName

end tell

Any help?

  • Try using: click button "Tak" of window 1 of application process "Microsoft Excel" – user3439894 Nov 27 '17 at 22:56
  • For future reference, we try to keep things entirely in English when possible. – JMY1000 Nov 28 '17 at 4:42
  • :( Try open OpenOffice file *.ods in Microsoft Excel – Grzegorz Nov 28 '17 at 17:56
  • Maybe this won't help you and your script, but... Keyboard Maestro has some pretty handy Interface Control actions. Makes it way simpler to do these kinds of things. — A simple button press might not be a good reason to buy it, since it isn't exactly cheap. Maybe if one wants to also trigger menu items and/or other things, then it would definitely be worth the price. At least in my experience, navigating menu items can be a reeaaallly irritating to do with applescript. In KBM you can just click the menu item you want to trigger. – Joonas Nov 30 '17 at 7:59

You must log in to answer this question.

Browse other questions tagged .