That's what the on OPEN event is for.

Replace On *:text:*#*:?:{ with On *:open:?:*#*:{