I am trying to quit an application and having no luck. I used the standard tell application “app_name” quit. The problem is in this application when you quit, it comes up with a confirm “Do you really want to quit” window that you have to click “OK” or “Cancel”.
I did try using the GUI scripting Click “OK” of window “Confirm” this appeared to click the OK button, but did not do anything.
Perhaps you could/should use the ‘killall’ shell command instead.
do shell script "killall "Microsoft Word""
Check out this post. There’s more info available if you search this site for “killall”.
The problem is that it is a server database application that needs to go through its shutdown process. Thanks though. Any other ideas?
Instead of using UI scripting to click, have you tried sending a return character to the program? If the confirmation box has ‘OK’ as the default answer, then a return should do it. It would look something like:
tell application “System Events”
tell process “your_database_app”
p.s IIRC the application you are sending the keystroke to needs to be frontmost. You may need to:
set frontmost to true
just before the keystroke.