Jump to content

MSN UDF


spyrorocks
 Share

Recommended Posts

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

func _msnsendtext($win, $msg)

if not IsObj($win) then return 0

$win.SendText($msg)

return 1

endfunc

How does this method work, I want to send a text to a window that is currently open.

if $msgtext = "1" then
$win = _msnopenchatwindow($msn, $email)
_msnsendtext($win, "uh")
endif

even if the window is open you can still use $win = _msnopenchatwindow($msn, $email)

but you have to know the email adress of the user.. hmss

Edited by Dellairion
Link to comment
Share on other sites

  • 2 months later...

OK, after a few hours of work, i have came up with a MSN UDF. I searched the board and found someone was supossibly working on one, but it was never realesed yet.

MSN.au3

It is in its early stages and i plan to add more features.

It currently supports the following functions:

_msncreate()

_msngetname()

_msngetemailaddress()

_msnsetstate()

_msnlogoff()

_msngetstate()

_msnlogin()

_msnopenchatwindow()

_msnclosechatwindow()

_msnsendtext()

_msnwindowmembers()

_msngetchattext()

Im sorry, but the code isent documentated. Im just releasing it to see if there is any interest. If there is, i will documentate it. you should be able to figure it out.

To capture incomming text, use the following code:

#include<MSN.au3>
$msn = _msncreate()

while 1
sleep(100)
wend

Func _msn_OnTextReceived($IMSession, $IMUser, $MsgHeader, $MsgText, $Something)
if $msgtext = "hello" then
msgbox(0, "", "Someone said 'Hello' To you")
endif
if $msgtext = "logout" then
_msnlogoff($msn)
endif
EndFunc

So, what do you guys think?

i cant download, why?
Link to comment
Share on other sites

not sure where to put this, but seems like support for live messenger is in high demand too.

the following script has been working for my live messenger (v8.1.0168.00)

this script gets your state and the state of a user of your choice

;object
$oMessenger = ObjCreate("Messenger.UIAutomation.1")

;get current user's status
$mystatus = $oMessenger.MyStatus()

;get current user's signin name
$myname = $oMessenger.MySigninName()

;get status of user
$useremail = InputBox("", "Enter email address of a messenger user:", "", "", 100, 10)
$userstatus = $oMessenger.GetContact($useremail, $oMessenger.MyServiceId).Status

;display status of current user and chosen user
MsgBox(0,"",$myname & "'s current status is: " & GetStatus($mystatus) & @CRLF & $useremail & "'s status is: " & GetStatus($userstatus))

Func GetStatus($status)
    If $status = 2 Then
        Return "Online"
    ElseIf $status = 10 Then
        Return "Busy"
    ElseIf $status = 14 Then
        Return "Be Right Back"
    ElseIf $status = 34 Then
        Return "Away"
    ElseIf $status = 50 Then
        Return "Phone"
    ElseIf $status = 66 Then
        Return "Lunch"
    ElseIf $status = 6 Then
        Return "Offline"
    Else
        Return "Unknown State"
    EndIf
EndFunc

here are some links that might help get this rolling

http://msdn2.microsoft.com/en-us/library/ms631614.aspx

http://msdn2.microsoft.com/en-gb/library/ms630961.aspx

http://msdn.microsoft.com/library/default..../getcontact.asp

http://msdn2.microsoft.com/en-us/library/ms631613.aspx

http://msdn2.microsoft.com/en-gb/library/ms630960.aspx

and some status states (from here)

typedef enum {
    MISTATUS_UNKNOWN = 0x0000,
    MISTATUS_OFFLINE = 0x0001,
    MISTATUS_ONLINE = 0x0002,
    MISTATUS_INVISIBLE = 0x0006,
    MISTATUS_BUSY = 0x000A,
    MISTATUS_BE_RIGHT_BACK = 0x000E,
    MISTATUS_IDLE = 0x0012,
    MISTATUS_AWAY = 0x0022,
    MISTATUS_ON_THE_PHONE = 0x0032,
    MISTATUS_OUT_TO_LUNCH = 0x0042,
    MISTATUS_LOCAL_FINDING_SERVER = 0x0100,
    MISTATUS_LOCAL_CONNECTING_TO_SERVER = 0x0200,
    MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = 0x0300,
    MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = 0x0400
} MISTATUS;

Edit: Typo and Live Messenger version added.

Edited by user52
Link to comment
Share on other sites

not sure where to put this, but seems like support for live messenger is in high demand too.

the following script has been working for my live messenger (v8.1.0168.00)

this script gets your state and the state of a user of your choice

;object
$oMessenger = ObjCreate("Messenger.UIAutomation.1")

;get current user's status
$mystatus = $oMessenger.MyStatus()

;get current user's signin name
$myname = $oMessenger.MySigninName()

;get status of user
$useremail = InputBox("", "Enter email address of a messenger user:", "", "", 100, 10)
$userstatus = $oMessenger.GetContact($useremail, $oMessenger.MyServiceId).Status

;display status of current user and chosen user
MsgBox(0,"",$myname & "'s current status is: " & GetStatus($mystatus) & @CRLF & $useremail & "'s status is: " & GetStatus($userstatus))

Func GetStatus($status)
    If $status = 2 Then
        Return "Online"
    ElseIf $status = 10 Then
        Return "Busy"
    ElseIf $status = 14 Then
        Return "Be Right Back"
    ElseIf $status = 34 Then
        Return "Away"
    ElseIf $status = 50 Then
        Return "Phone"
    ElseIf $status = 66 Then
        Return "Lunch"
    ElseIf $status = 6 Then
        Return "Offline"
    Else
        Return "Unknown State"
    EndIf
EndFunc

here are some links that might help get this rolling

http://msdn2.microsoft.com/en-us/library/ms631614.aspx

http://msdn2.microsoft.com/en-gb/library/ms630961.aspx

http://msdn.microsoft.com/library/default..../getcontact.asp

http://msdn2.microsoft.com/en-us/library/ms631613.aspx

http://msdn2.microsoft.com/en-gb/library/ms630960.aspx

and some status states (from here)

typedef enum {
    MISTATUS_UNKNOWN = 0x0000,
    MISTATUS_OFFLINE = 0x0001,
    MISTATUS_ONLINE = 0x0002,
    MISTATUS_INVISIBLE = 0x0006,
    MISTATUS_BUSY = 0x000A,
    MISTATUS_BE_RIGHT_BACK = 0x000E,
    MISTATUS_IDLE = 0x0012,
    MISTATUS_AWAY = 0x0022,
    MISTATUS_ON_THE_PHONE = 0x0032,
    MISTATUS_OUT_TO_LUNCH = 0x0042,
    MISTATUS_LOCAL_FINDING_SERVER = 0x0100,
    MISTATUS_LOCAL_CONNECTING_TO_SERVER = 0x0200,
    MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = 0x0300,
    MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = 0x0400
} MISTATUS;

Edit: Typo and Live Messenger version added.

GREAT!

*goes to write UDFs*

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

yay. All done. BUT NOT YET TESTED

;status codes
$MSN_STATUS_UNKNOWN = 0x0000
$MSN_STATUS_OFFLINE = 0x0001
$MSN_STATUS_AVAILABLE = 0x0002
$MSN_STATUS_INVISIBLE = 0x0006
$MSN_STATUS_BUSY = 0x000A
$MSN_STATUS_BRB = 0x000E
$MSN_STATUS_IDLE = 0x0012
$MSN_STATUS_AWAY = 0x0022
$MSN_STATUS_PHONE = 0x0032
$MSN_STATUS_LUNCH = 0x0042
$MSN_STATUS_FINDING_SERVER = 0x0100
$MSN_STATUS_CONNECTING = 0x0200
$MSN_STATUS_SYNCING = 0x0300
$MSN_STATUS_DISCONNECTING = 0x0400

;returns an msn automation object
Func _msnmCreate ()
    $ret = ObjCreate("Messenger.UIAutomation.1")
    if IsObj ($ret) Then
        Return $ret
    Else
        return 0
    EndIf
EndFunc

;launches the Add Contact wizard. If an email adress is given, it skips the first page where the user is asked for the email address.
Func _msnmContactAdd ($oMSN, $sEmail='')
    Return $oMSN.AddContact (0, $sEmail)
EndFunc

;signs into msn. if no username and password are given, uses automatic sign in.
func _msnmSignIn ($oMSN, $sUser='', $sPass='')
    if $sUser <> '' And $sPass <> '' Then
        Return $oMSN.Signin(0, $sUser, $sPass
    Else
        return $oMSN.AutoSignin ()
    EndIf
EndFunc

;returns a contact object
Func _msnmContactObjGet ($oMSN, $sEmail)
    Return $oMSN.GetContact ($sEmail, '')
EndFunc

;$vContact can be string or Contact object as returned by _msnmContactObjGet or _msnmContactObjGetByIndex.
;If $vContact is a string, it must be the email address of the person to message.
;returns a Window object
Func _msnmConvWinOpen ($oMSN, $vContact)
    Return $oMSN.InstantMessage ($vContact)
EndFunc

;returns a MessengerContacts object
Func _msnmGetContactList ($oMSN)
    Return $oMSN.MyContacts
EndFunc

;Deprecated in Windows Messenger 5.0
Func _msnmMyFriendlyName ($oMSN)
    return $oMSN.MyFriendlyName
EndFunc

;Deprecated in Windows Messenger 5.0
Func _msnmMyEmail ($oMSN)
    Return $oMSN.MySigninName
EndFunc

;Deprecated in Windows Messenger 5.0
Func _msnmMyStatus ($oMSN)
    return $oMSN.MyStatus
EndFunc

;Deprecated in Windows Messenger 5.0
Func _msnmSetStatus ($iStatus)
    $oMSN.MyStatus = $iStatus
EndFunc

;returns True or False
;$oContact is a Contact object as returned by _msnmContactObjGet or _msnmContactObjGetByIndex
Func _msnmContactIsBlocked ($oContact)
    Return $oContact.Blocked
EndFunc

;$oContact is a Contact object as returned by _msnmContactObjGet or _msnmContactObjGetByIndex
Func _msnmContactBlock ($oContact)
    $oContact.Blocked=True
EndFunc

;$oContact is a Contact object as returned by _msnmContactObjGet or _msnmContactObjGetByIndex
Func _msnmContactUnblock ($oContact)
    $oContact.Blocked=False
EndFunc

;$oContact is a Contact object as returned by _msnmContactObjGet or _msnmContactObjGetByIndex
Func _msnmContactFriendlyName ($oContact)
    Return $oContact.FriendlyName
EndFunc

;$oContact is a Contact object as returned by _msnmContactObjectGet or _msnmContactObjGetByIndex
Func _msnmContactEmail ($oContact)
    Return $oContact.SigninName
EndFunc

;$oList is the MessengerContacts object as returned by _msnmGetContactList
Func _msnmNumContacts ($oList)
    Return $oList.Count
EndFunc

;returns the Contact object of the contact in the specified index.
;(I am not sure wether the index is 0-based or 1-based....)
;$oList is the MessengerContacts object as returned by _msnmGetContactList
Func _msnmContactObjGetByIndex ($oList, $iIndex)
    Return $oList.Item ($iIndex)
EndFunc

;$oList is the MessengerContacts object as returned by _msnmGetContactList
;$oContact is a Contact object as returned by _msnmContactObjGet or _msnmContactObjGetByIndex
Func _msnmContactRemove ($oList, $oContact)
    Return $oList.Remove ($oContact)
EndFunc

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...