Sign in to follow this  
Followers 0

Skype COM Examples - Skype4COMLib

18 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Posted

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

Share this post


Link to post
Share on other sites

Posted

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

Thanks alot.

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

Posted

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

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

Share this post


Link to post
Share on other sites

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

Posted

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

Share this post


Link to post
Share on other sites

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

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

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

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

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

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

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.

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