Sign in to follow this  
Followers 0

Skype COM Examples - Skype4COMLib

18 posts in this topic

#1 ·  Posted (edited)

I have manually converted all Skype4COMLib VBS examples (found HERE) to AutoIt. I have also created a UDF library - http://www.autoitscript.com/forum/index.php?showtopic=75056.

IMPORTANT: Skype4Com.dll is automatically included together with Skype Extras Manager during Skype installation. If a user has unchecked Extras Manager during installation, Skype4Com library will be unavailable on that machine and these examples will not work.

Notes:

  • All examples have had code added, if they did not already have it, to verify that Skype is running and a user is signed in.
  • All examples use a Skype event handler to detect changes once attached to the Skype API.
  • The COM Error handler for each example simply allows the script to continue, because the section that verifies a user is logged in will error on the first object until Skype is running (I'm working on fixing this so an error handler can be used properly).
If you find any errors or have any trouble, please feel free to send me a PM or post a reply to this thread, and I will help you as best I can.

Thanks and enjoy!

Andy

Answer.au3 - This script sets up automatic answering of incoming calls.

Attach.au3 - This script listens for connections on the Skype API, connects when available, and holds the skypename of the user when a connection is successful.

Buttons.au3 - This script sends key press events to the Skype client.

Call.au3 - This script places a call through the Skype API, and monitors status while the call is in progress.

Chats.au3 - This script queries chats in chat history.

Chats2.au3 - An improved chats example to illustrate new chat properties.

Client.au3 - This script opens different windows in the Skype client.

Command.au3 - This script sends blocking and non-blocking commands to the Skype API.

Conference.au3 - This script creates a conference call.

Conferences.au3 - This script lists conference calls hosted by a user, and lists participants in conference calls not hosted by a user.

FileTransfers.au3 - This script lists file transfers.

GroupChat.au3 - This script creates a group chat.

Groups.au3 - This script manages various aspects of contact groups.

Join.au3 - This script joins callers to form a conference call.

MessageStatus.au3 - This script logs chat text messages.

MissedMessages.au3 - This script list all missed messages and changes message status to "Read".

Plugins.au3 - This script demos how to create plugin menu items and events.

Profile.au3 - This script lists the profile properties for the current user.

Response.au3 - This script provides a response to a message received in a chat.

Search.au3 - This script performs a simple search for a user.

Settings.au3 - This script queries the Skype general parameters.

Sms.au3 - This script sends a SMS message.

Smss.au3 - This script lists all SMS messages.

VoicemailServer.au3 - This script listens for new voicemails, sends SMS message and answers incoming calls.

Edited by Airwolf

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hay Airwofl,

First off Great work and Thankyou for sharing.

I got an error when running "sms.au3"

C:\Documents and Settings\Desktop\New AutoIt v3 Script.au3 (42) : ==> Error in expression.:

If $oSkype.CurrentUserStatus = $oSkype.Convert.TextToUserStatus("ONLINE") Then

If ^ ERROR


There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

#3 ·  Posted

Hay Airwofl,

First off Great work and Thankyou for sharing.

I got an error when running "sms.au3"

I know this seems like a dumb question, but do you have Skype installed?

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#4 ·  Posted

That was it, I had the old 2.2 installed. I upgraded to the current 3.8 and it is Workin :)


There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

#5 ·  Posted

This is great! I've needed these for awhile...just too lazy to make them. lol.

Thanks alot.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

#6 ·  Posted

Great work Airwolf. thanks for sharing..

do you have functions to close windows?

the Quality feedback mgr keeps opening.. as well as the client when i'm in a call.

or do you suggest just using standard autoit window close calls?

thanks

Share this post


Link to post
Share on other sites

#7 ·  Posted

Great work Airwolf. thanks for sharing..

do you have functions to close windows?

the Quality feedback mgr keeps opening.. as well as the client when i'm in a call.

or do you suggest just using standard autoit window close calls?

thanks

You can use standard AutoIt window closes if you'd like, but I think the GroupChat.au3 example goes over opening and closing a chat window with multiple users. The same methods apply to a single chat aside from the opening part (a groupchat calls a window with a collection of members, whereas a standard chat calls a window aimed at one user).

Group Chat Example:

;// Create a UserCollection object and add the multichat users to this collection:
$oMembers = ObjCreate("Skype4COM.UserCollection")
$oMembers.Add($oSkype.User("skypeuser2"))
$oMembers.Add($oSkype.User("skypeuser3"))

;// Create a multichat:
$oChat = $oSkype.CreateChatMultiple($oMembers)

;// Open a chat window:
$oChat.OpenWindow

;// Set a chat topic:
$oChat.Topic = "Skype is cool"

;// Send a chat message:
$oMsg = $oChat.SendMessage("Greetings!")

;// Leave a chat:
$oChat.LeaveoÝ÷ ØZ½é÷öÛ^²×¶¬nëHÂ¥v))ÞÊ¢é]¢§jwjËZÖ«uÈZ¶X¤zʺÚ"µÍËËÈÜX]HHÝ[Ú]ÌÍÛÐÚ]H   ÌÍÛÔÚÞKÜX]PÚ]Ú]
    ÌÍÛÔÚÞKÙ ][ÝÜÚÞ]Ù][ÝÊJBËËÈÜ[HÚ]Ú[ÝÎÌÍÛÐÚ]Ü[Ú[ÝÂËËÈÙ]HÚ]ÜXÎÌÍÛÐÚ]ÜXÈH   ][ÝÔÚÞHÈÛÛÛ ][ÝÂËËÈÙ[HÚ]YÜØYÙNÌÍÛÓÙÈH   ÌÍÛÐÚ]Ù[YÜØYÙJ ][ÝÑÜY][ÜÉÌÌÎÉ][ÝÊBËËÈX]HHÚ]ÌÍÛÐÚ]X]

For other types of windows, you'd have to know which method to call for the specific object type to close the window. It is a bit more complicated to close the windows with object methods than with AutoIt WinClose(), etc. Either way will work; the choice is yours.

Andy


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#8 ·  Posted

if user is incognito lets say, chats2.au3 gives error...

otherwise: great work! keep it up, w8ing for da udf


Is There A Life BEFORE Death?im stupidSaved warn logs: cheateraSmOke_N Note Added 17 January 2009 - 02:54 PM Added to warn level Posting a way to hack the registry and force sending someones desktop via TCP. Jos Note Added 25 November 2008 - 02:52 PM Added to warn level for being an impolite rookie.once a year i go bad ... what will happen in 2010??[u]Its GOOD to be BAD ... (Warlock's Succubus - World of Warcraft)[/u]

Share this post


Link to post
Share on other sites

#9 ·  Posted

w8ing for da udf

Just FYI in case someone stumbles across this thread and would like to know, the UDF has been created (link below).

http://www.autoitscript.com/forum/index.php?showtopic=75056


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#10 ·  Posted

hi there, i tryed the received.au3, but it didn´t work for me?! maybe someone else can check it please?!

i deleted some code from the received.au3 i didn´t need, for example "online check" and so on..

skype is online, Skype4COM.dll is in the same folder like the edited *.au3, *.au3 script is running,

some incoming chatevents on skype BUT it seems the code never jumped in one of these functions?!

Sending a msg with another autoit script to a specified user/chat works fine!

where is the mistake?! maybe someone can help please...

below the code:

;// Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype")
$oSkypeEvent = ObjEvent($oSkype,"Skype_")
$oError = ObjEvent("AutoIt.Error","MyErrFunc")

;// Declare the following Skype constants:
$cAttachmentStatus_Available = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE")
$cMessageStatus_Sending = $oSkype.Convert.TextToChatMessageStatus("SENDING")
$cMessageStatus_Received = $oSkype.Convert.TextToChatMessageStatus("RECEIVED")
$cMessageType_Said = $oSkype.Convert.TextToChatMessageType("SAID")
$cMessageType_Left = $oSkype.Convert.TextToChatMessageType("LEFT")


;// Sleep 
While 1
    Sleep(1000)
WEnd


;// The AttachmentStatus event handler monitors attachment status and automatically attempts to reattach to the API following loss of connection:
Func Skype_AttachmentStatus($aStatus)
    MsgBox(0,"","Attachment status " & $oSkype.Convert.AttachmentStatusToText($aStatus))
    If $aStatus = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE") Then
        $oSkype.Attach()
    EndIf
EndFunc

;// The MessageStatus event handler monitors message status, decodes received messages and, for those of type "Said", sends an autoresponse quoting the original message:
Func Skype_MessageStatus($aMsg, $aStatus)
    MsgBox(0,"","Message " & $aMsg.Id & " status " & $oSkype.Convert.ChatMessageStatusToText($aStatus))
    If $aStatus = $cMessageStatus_Received Then 
        DecodeMsg($aMsg)
        If $aMsg.Type = $cMessageType_Said Then
            MsgBox(0,"","TEST")
        ;$oSkype.SendMessage($aMsg.FromHandle, "This is autoresponse.")
            $aMsg.Chat.SendMessage("You said [" & $aMsg.Body & "]")
        EndIf
    EndIf   
EndFunc

;// The DecodeMsg event handler decodes messages in a chat and converts leave reasons to text for messages of type "Left":
Func DecodeMsg($oMsg) 
    MsgBox(0,"","DecodeMsg TEST")
    $sText = $oMsg.FromHandle & " " & $oSkype.Convert.ChatMessageTypeToText($oMsg.Type) & ":"
    If StringLen($oMsg.Body) Then 
        $sText = $sText & " " & $oMsg.Body
    EndIf
    Dim $oUser
    For $oUser In $oMsg.Users
        $sText = $sText & " " & $oUser.Handle
    Next
    If $oMsg.Type = $cMessageType_Left Then 
        $sText = $sText & " " & $oSkype.Convert.ChatLeaveReasonToText($oMsg.LeaveReason)
    EndIf
    MsgBox(0,"",$sText)
EndFunc

Func MyErrFunc()
;Do Nothing
EndFunc

Share this post


Link to post
Share on other sites

#11 ·  Posted

no way to edit/delete post, sorry. problem solved! :P

Share this post


Link to post
Share on other sites

#12 ·  Posted

Hello everybody. When running sms.au3, I am experiencing a similar problem to one addressed before, but don't know the solution. I get

Line 42 (File "C:\Users\Luis\Desktop\Docs\AutoIt\Sms.au3"):

If $oSkype.CurrentUserStatus = $oSkype.Convert.TextToUserStatus("ONLINE") Then

If ^ ERROR

Error: Error in expression.

Skype4COM.dll is is in the same folder as Sms.au3; and it is running fine.

I am new to Auotit and got it because I am trying to automate some functions in skype, and it looks like a variation of sms.au3 is what I need. I am using Skype 3.8.0.188

Any help is appreciated.

Regards

Share this post


Link to post
Share on other sites

#13 ·  Posted

Im looking for a skype script that checks the chat for a particulart word and displays a messagebox, like there is a new message!.

I dont know whether this is included in the API.

Share this post


Link to post
Share on other sites

#14 ·  Posted

Im looking for a skype script that checks the chat for a particulart word and displays a messagebox, like there is a new message!.

I dont know whether this is included in the API.

#cs ----------------------------------------------------------------------------
testing alert new messages.
#ce ----------------------------------------------------------------------------
;// Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype")
$oSkypeEvent = ObjEvent($oSkype,"Skype_")
$oError = ObjEvent("AutoIt.Error","MyErrFunc")
;// Start the Skype client:
If Not $oSkype.Client.IsRunning Then
    $oSkype.Client.Start()
EndIf
;// Verify that a user is signed in and online before continuing
While 1
    If $oSkype.CurrentUserStatus = $oSkype.Convert.TextToUserStatus("ONLINE") Then
        ExitLoop
    Else
        $oSkype.ChangeUserStatus($oSkype.Convert.TextToUserStatus("ONLINE"))
    EndIf
    Sleep(1000)
WEnd
;// The AttachmentStatus event handler monitors attachment status and automatically attempts to reattach to the API following loss of connection:
Func Skype_AttachmentStatus($aStatus)
    MsgBox(0,"","Attachment status " & $oSkype.Convert.AttachmentStatusToText($aStatus))
    If $aStatus = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE") Then
        $oSkype.Attach()
    EndIf
EndFunc


;// messagebox Message received from "user"
Func Skype_MessageStatus($aMsg, $aStatus)
    if ($aStatus = $oSkype.Convert.TextToChatMessageStatus("RECEIVED")) and  _
        $aMsg.Type = $oSkype.Convert.TextToChatMessageType("SAID") Then
    MsgBox(0,"","Message " & $aMsg.Id & " " & $aMsg.FromHandle & " said " & $aMsg.Body)
;MsgBox(0,"","Total missed message count: " & $oSkype.MissedMessages.Count)
EndIf
EndFunc

While 1
    sleep(1000)
WEnd

I now have this, which works pretty good. the next thing is need is that it triggers on a word or chatgroup.

Share this post


Link to post
Share on other sites

#15 ·  Posted

Hi,

every time i execute the script i get the following error

Error in expression.:

Const $UserStatus_Offline = $oSkype.Convert.TextToUserStatus("OFFLINE")

Const $UserStatus_Offline = ^ ERROR

->14:07:11 AutoIT3.exe ended.rc:1

Can some one help me in fixing this issue ?

Share this post


Link to post
Share on other sites

#16 ·  Posted

Hi,

every time i execute the script i get the following error

Error in expression.:

Const $UserStatus_Offline = $oSkype.Convert.TextToUserStatus("OFFLINE")

Const $UserStatus_Offline = ^ ERROR

->14:07:11 AutoIT3.exe ended.rc:1

Can some one help me in fixing this issue ?

Did you have $oSkype initialized? Like with

Global $oSkype = ObjCreate("Skype4COM.Skype")

Share this post


Link to post
Share on other sites

#17 ·  Posted

How to get the name of a group?

Basic setup: groups get created and deleted as planned. But I am member of a group (which is always open & active) whose name does not show up in the resulting list of

For $oChat In $oSkype.ActiveChats

$msgstring = $msgstring & @CR & $oChat.Timestamp & " by " & $oChat.Name & " friendlyName:" & $oChat.FriendlyName

Next

nor does it show in

For $oGroup In $oSkype.CustomGroups

or

$oSkype.HardwiredGroups

Sending a message to individual participants using

$oSkype.SendMessage("individual_user", "Wishing you a nice weekend!")

works fine.

But sending

$oSkype.SendMessage("group_name", "Wishing you all a nice weekend!")
or

$ichat.SendMessage("group_name", "Wishing you all a nice weekend!")

gets executed, but shows no new entry on the chat window. I already had renamed the group from a rather long name to a very simple one, but to no avail ...

There is a function Skype_GroupVisible($aGroup, $aVisible) available in the groups.au3 script, but I have no idea how to apply that to a group that is not listed in the above results.

Is there another way of finding out the name of the group (that is listed in the contact list)?

Share this post


Link to post
Share on other sites

#18 ·  Posted

Hi,

Try this :

#include "Skype.au3"

Local $oActiveChats = _Skype_ChatGetActive()
_List($oActiveChats)

ConsoleWrite("!---------------------------" & @CrLf)

Local $oAllChats = _Skype_ChatGetAll()
_List($oAllChats)

Func _List($oChats)
If IsArray($oChats) Then
Local $oChat

For $iChat = 0 To UBound($oChats) -1
$oChat = $oChats[$iChat]

Local $aMembers = _Skype_ChatGetMembers($oChat)

Local $sUsersFullNames
For $iUser = 2 To $aMembers[0] - 1 ;0: number of members, 1: yourself
$sUsersFullNames &= _Skype_UserGetFullName($aMembers[$iUser]) & ", "
Next

ConsoleWrite("Chat " & $iChat & ": " & _Skype_ChatGetName($oChat) _
& @CrLf & "Members: " & StringTrimRight($sUsersFullNames, 2) _
& @crlf & "Description: " & _Skype_ChatGetDescription($oChat) & @CrLf & @CrLf)
Next
EndIf
EndFunc

The Skype UDF is in my signature.

Br, FireFox.


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

Updated 07 November, 2013 - If you find dead links please send me a PM, do not post in the topics !

Share this post


Link to post
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
Sign in to follow this  
Followers 0