Skype automation (Intermediate)

Skype sends messages to a selected user. Consider two similar SendChat functions as an example. Echo123 is Skype's default sound test user. Change it to another user name you want from user properties (space not allowed).

Getting ready

We will start by opening SciTE from the AutoIt Program Group and start writing source code. Open the Skype app (Version 3.0 and above must be installed). Download it from http://www.autoitscript.com/forum/topic/121767-skype-udf-v0-7-april-13-2013/, and copy and paste the Skype.au3 library file to the same folder as Skypetemplate.au3.

How to do it...

Copy and paste the source code into a new script called the Skypetemplate.au3 file, and run the script by pressing F5.

#include "Skype.au3" 
;Credits Basicos ; And to Firefox Skype.au3,SendChat UDF 
SendChat1("I will be at home in 10 minutes","echo123") 
SendChat2("I will be at home in 15 minutes","echo123") 
Func SendChat1($message,$destination) 
Local $iChatId, $oChat ;using chat id: 
$iChatId = _Skype_ChatCreate("echo123") ;Skype test Service 
_Skype_ChatMessage($iChatId, "test") 
EndFunc 
Func SendChat2($message,$destination) 
Local $iChatId, $oChat ;using chat object: 
$oChat = _Skype_ChatCreateWith("maribelnv") ; your friend 
_Skype_ChatSendMessage($oChat, "test3") 
EndFunc 

How it works...

In Skype.au3 functions, Skype4COM provides an ActiveX interface to the Skype API such as Visual Studio or Delphi. It is an external user defined function (UDF), created and provided free for a Firefox user.

COM stands for Component Object Model. It is the Microsoft way to interconnect software using a common interface defined in a COM object.

You can do most of your programming with AutoIt's built-in functions, use this only for special interfacing to some applications. Objects depend heavily on the operating system and the installed software.

There's more...

Skype.zip downloaded files include an example for auto call answer to answer calls automatically (and it joins calls if you're already in a call):

  • Using an event call:
    _Skype_OnEventCallStatus("_CallIncomming", $cClsRinging) ;if someone is calling you _Skype_OnEventCallStatus("_CallFinished", $cClsFinished) ;if a call has finished 
    While 1 
    Sleep(60000)
     WEnd 
  • Using call answer and call join functions:
    If IsObj($oMainCall) Then ;if a call is running then join the incomming call to the main    _Skype_CallJoin($oMainCall, $oCall) 
    Else ;else answer 
      _Skype_CallAnswer($oCall) 
    EndIf 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset