Creating a new tab in an existing window

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
SimonBS
Harmless
Posts: 1
Joined: Tue Oct 11, 2011 9:10 pm

Creating a new tab in an existing window

Post by SimonBS »

Hello,

I am trying to start a new chat with a contact and add this chat as a tab in an already existing chat window. When doing so, I get the following error:
Can't create chat in that chat window.
This is the code I am using. First I retrieve all chat windows where the ID is not "-1" (I don't know why these might show up. Probably closed chat windows?). Then I check if there are any chat windows, if there are, I want to start a new chat in one of these. If there are no existing chat windows, then I create a new.

Code: Select all

set myChatWindows to every chat window where id is not "-1"
if length of myChatWindows > 0 then
	# Create new tab
	tell (account of firstContact) to make new chat with contacts {firstContact} at (item 1 of myChatWindows)
else
	# Start new chat with account of first contact
	tell (account of firstContact) to make new chat with contacts {firstContact} with new chat window
end if
Creating a new tab returns the error above. I have no problem creating a new chat window when no one exist already.

Does anyone have an idea what I am doing wrong?

Best regards,
Simon B. Støvring
Post Reply