In scripts it's better to use /msg #channel instead of /say and /describe #channel instead of /me. (change #channel with the name of your channel ofcourse).

Now for the second problem: I'm not aware of a $id that gives you the last active channel, you can get the current active window with $active, but on your custom window, it will show @windowname...