If you are opening the query by double-clicking in the nicklist, I believe you can change the default
double-click event to an alias that will open the query and reference the other commands you want
to be performed.
mIRC > Options > Mouse > Nicklist
like instead of
you could put
and have in remotes
alias myquery {
query $$1
<alias to other commands>
}
Just a thought.