Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lynkynpark86

macrumors 6502
Original poster
I'm trying to make my app quit itself by pushing a button. I could just connect the button to application with terminate, but then it wouldn't run the script it is attached to. I want something like this:
Code:
tell window "main window"
set varact to contents of text field "action"
if varact is "beep"
beep
else
-- do nothing
end if
end tell
terminate myapp
I want to know how to make the script tell the application it is controlling to quit. HELP!
 
It's a little unclear what you're doing and why, but this is the standard way to quit an app in AppleScript:

Code:
tell application "Preview" to quit

If you're already in the "tell application" block, you can just use "quit".
 
Not quite

Yes, that would normally work, but I want my app to quit itself. If app123 has "tell application 'app123' to quit" it will get an error because it tries to quit before it reads the end tell. I want it to tell the window to preform the "terminate" action AFTER it runs the script, so i cant connect the button to the application with terminate as the action
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.