How to wait for user to complete Export?

I’m trying to write a macro for exporting a Keynote slide. My macro invokes the File | Export To | Movie menu function, fills out the dialog box, and then presses Enter. That all works fine. But then Keynote displays a dialog box for the user to enter a file name. This is where I’m struggling.

I want the macro to pause and wait for the user to name the file. Once he’s done that, he will then either (a) press Enter or (b) click on the Export button to finish his input. If the file already exists, Keynote will prompt him to Cancel or Replace the file. I want the program to wait for the user to respond and then proceed accordingly.

Regardless of the option he chooses (Cancel or Replace), I want the macro to complete one more action before he finishes (e.g., delete a slide).

Because Keynote does not assign a name to the Export window, I can’t simply wait until the Front Window is not, for example, "Export.”

How can I do this?

That is exactly what the Select or Show a Menu Item action will do when you choose the menu item.

Your macro will continue with the next Action after the user completes all of the File > Export stuff.

Thanks so much for this tip. It works; however, it seems I have to use a Pause action after the Select or Show a Menu Item action to allow enough time for the user to confirm his selection and then for the file to export. If I set that Pause too short, the macro doesn’t execute the actions following the Export.

I was hoping to find a way to execute these actions after the Export regardless of how long the user takes to confirm the Export dialog box.

Any further thoughts? Am I missing something here.

Use a Pause Until action with a button or window condition.
First a PU button is enabled.
Then a PU button does not exist.

You could use a similar approach with window title.