Help a little with applescript to check frontmost app

I need to have an applescript where I send a hotkey with applescript only if iTerm is frontmost and open. I tried making something like this :

Can you help me complete this, I am really not that familiar with applescript :frowning:

Thank you for any help.

This?

if application "iTerm" is frontmost then
  display alert "iTerm is frontmost"
else
  display alert "iTerm is not frontmost"
end if
2 Likes

Thank you, this works.