Actually Ghost-writer's altered version will make it only work when you're not looking at the active window. Furthermore, the dollar sign ($) next to the text event is not needed, since this is not a regex match.
And as sunslayer's stated, and I wish Ghost-writer's mentality can be more like yours, that using $iif is pointless when you are making one comparison. Now, that is a helpful tip right there.