By creating the "Messenger.UIAutomation" object, there is no too much difference between automating Live Messenger (aka. MSN Messenger 8.0) and the previous versions (6.0, 7.0, 7.5):
STATUS_OFFLINE = 1
STATUS_ONLINE = 2
![]()
SET obj = CreateObject("Messenger.UIAutomation")
![]()
Signin
addContact
![]()
SUB Signin
IF obj.MyStatus = STATUS_OFFLINE THEN
obj.AutoSignin
DO UNTIL obj.MyStatus = STATUS_ONLINE
WScript.Sleep 2000
LOOP
END IF
END SUB
![]()
SUB Signout
IF obj.MyStatus = STATUS_ONLINE THEN
obj.Signout
DO UNTIL obj.MyStatus = STATUS_OFFLINE
WScript.Sleep 2000
LOOP
END IF
END SUB
![]()
SUB addContact
obj.AddContact 0,"zhengziying@hotmail.com"
END SUB
But I found the "Messenger.MessengerApp" object doesn't work for Live Messenger. Neither does the "MSNMessenger.MessengerApp" object and others, such as "Messenger.MsgrObject", etc. CreateObject returns a non-nil object but any method/property call gets an 0x80004005 error. Don't know why. Maybe it's temporarily not supported by the beta version; maybe we need to call in a new way.
随贴广告(测试期)
打印 | 张贴于 2006-03-01 08:08:00 | Tag:Cool Stuffs


留言反馈
虽然v8也可以适用
messenger的automation在各个机器上的行为不一样,而且还和script跑在什么script host里面也有关系:IE 6, IE 7, WSH有可能得到不一样的结果。
it seems the sub signout does not work.