Clicking OK in Early OS X

Can anyone tell me how I can eliminate (hit OK) an error message in an application?

I have the application starting up and it updates from a central location, then I want the script to wait (got that), then the application provides a message that it has finished updating and it will restart, and I want to hit ok with the script, wait for it to restart then quit.

Thanks.

Is the OK button the default button? If so, something like this might work if you have GUI scripting enabled.

tell application "your app" to activate
tell application "System Events" to keystroke return

– Rob

Yes, it is.

Didn’t work. Any other suggestions?

No.

How do I know if GUI scripting is enabled or how do I enable it?

Btw, does this work in OS X?

GUI scripting is included in Panther. In Jaguar (10.2.3 or later), you’ll need to install System Events version 1.2 [d/l]. It is beta software but it hasn’t caused problems on my machine. To enable UI scripting, go to the Universal Access pref pane and “Enable access for assistive devices”. Once installed, check the dictionary of System Events to see what can be done. If you plan to do more than casual UI scripting, I recommend PreFab UI Browser.

– Rob

I have 10.1 and 10.2 on our machines, so this is not gonna work. :frowning:

You might take a look at Extra Suites. Among other goodies, it offers the following:

I think it will work on 10.1 and later and it offers a way to distribute scripts to users without requiring them to pay the license fee.

– Rob

I know this is a late response to the question, but I found a bit of code which answered a similar question I had:

tell application "System Events"
tell process "your app"
	keystroke return
end tell
end tell

Also, you’ll need to install this if you’re running Jaguar to run System Events.