how can an action perform an "activate" and "quit" command to one app?

Well, I have my script running. It will open an item if I push a button. How can I make it close the application if I push the same button again? Does it invlove a variable? Seems tricky.

if (keys pressed) contains "F1" then
	tell process "iChat"
		activate
	end tell
end if

if (keys pressed) contains "F1" then
	tell process "iChat"
		quit
	end tell
end if

You could try something like this:

property currentState : 0

if (keys_pressed) contains "F1" then
	if currentState is 0 then
		activate application "iChat"
	else
		quit application "iChat"
	end if
	
	set currentState to (currentState + 1) mod 2
end if

thanks Bruce!