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

Amad3U5

macrumors member
Original poster
Nov 17, 2012
44
0
Sydney
I want to write an AppleScript that will force-quit the application running in the fore-ground (i.e the application in the status bar).

How can I use AppleScript to determine what that application is?
 

Mark FX

macrumors regular
Nov 18, 2011
159
17
West Sussex, UK
Just expanding on what bumper314 has posted.

Code:
tell application "System Events"
	set frontmostApp to name of application processes whose frontmost is true
	tell application frontmostApp
		quit
	end tell
end tell

This wont work in Applescript Editor, as Applescript editor will be the fronmost app, and will still be processing and running the script, so will only work when the script is compiled.

Regards Mark
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.