You could use the Messenger.CurrentChats property to get a ChatWnds object containing all the open chats, and then use the count property of the ChatWnds object to get the count.
code:
var chatWndsObj = Messenger.CurrentChats;
var chatCount = chatWndsObj.count;
And the varible chatCount would contain the number of open chats
All these propertys and more info on them can be found in the
scripting documentation
Note about the previous replys: Please the correct help, or don't bother at all. If you had taken your time to look into the question you would have been able to give the complete and correct answer straight away![/cookie mode <3]