I don't think there's a way to detect if you opened the window. Mainly because if you opened it manually, then you know you did it. So the event is unnecessary. Someone correct me if I'm wrong.
I think you will have to change the on open event to an alias and manually check when you open the window.
alias cl {
var %nick = $replace($active,$chr(124),$chr(95),$chr(92),$chr(95))
var %ctime = $calc($ctime - $file($+($logdir,%nick,.,$network,.log)).ctime)
echo -a $iif(%ctime < 5,Log created for $active, Log exists for $active)
}To use, open a query window and type /cl
Since you must do this manually, you have to issue the command within about 4 seconds of opening the window if you want it to say the file was created (only if it didn't already exist). Otherwise it will say it already exists if 5 seconds have elapsed.