Target of what? If you're thinking $target, keep in mind that $target comes directly from the server message, so it doesn't necessarily refer to a window (eg in incoming private messages $target is $me). If you want the wid of a window you can always use $chan(..).wid, $query(...).wid, $window(...).wid etc.