May I ask what you are trying to do?
If dialog is running and you want something to happen, then your best bet is the just add the commands inside the dialog, if you want some BG stuff going at the same time it's a bit more complex (I don't know exactly how, but do a forum search. It has been answered not too long along... this week I believe).
As for when the dialog is stopped, I normally check for a particular dialog option and to see if it has been selected, but there's about (at least) 3 different ways to check for dialog ending.
If dialog is running and you want something to happen, then your best bet is the just add the commands inside the dialog, if you want some BG stuff going at the same time it's a bit more complex (I don't know exactly how, but do a forum search. It has been answered not too long along... this week I believe).
As for when the dialog is stopped, I normally check for a particular dialog option and to see if it has been selected, but there's about (at least) 3 different ways to check for dialog ending.