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