tell application "System Events" to set theProcessList to name of every process
theProcessList
if theProcessList contains "TextEdit" then
tell application "TextEdit" to quit
else
tell application "TextEdit" to activate
end if