Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

AppleScript to test if application is running (See related posts)

By name:
tell application "System Events" to (name of processes) contains "iTunes"


By creator type, in case it might have a version # appended:
tell application "System Events" to (creator type of processes) contains "InDn"


Grab creator type dynamically like so:
tell application "Finder" to creator type of (selection as alias)


From http://applescriptsourcebook.com/viewtopic.php?pid=46830


Comments on this post

deweller posts on Jul 20, 2007 at 13:39
Here is a an example of how to use this:


if appIsRunning("iChat") then
	tell application "iChat"
		set status to available
	end tell
end if


on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning

srhamy posts on Dec 07, 2008 at 06:41
How about run if not running, minimize if shown, or make visible if hidden?

Here's what I came up with, but cannot get it working

tell application "System Events" to set theCount to the count of (processes whose name is "Finder")
if theCount = 0 then
	-- run tri
else
	--first get name of top most app
	tell application "System Events" to set frontApp to name of application processes whose frontmost is true
	if frontApp = "Finder" then
	  tell "System Events" to keystroke "h" using command down
	else
		tell application "Finder" to activate
	end if
end if
hamelao posts on Mar 11, 2012 at 18:26
If the account's name is "admin", run the delete script above will delete the admin group, and this will cause no accounts has admin privileges also cannot create a account as administrator.easter quotes
hamelao posts on Mar 11, 2012 at 18:27
A double-quoted line preceded by a dollar mark ($) testament spout the queue to be translated according to the current locale. love quotes If the turning perspectives is C or POSIX, the dollar indicator is ignored. If the wire is translated and replaced, the restraints is double-quoted.

You need to create an account or log in to post comments to this site.


Related Posts