Skype4COM: Buttons.vbs

Skype4COM

Buttons.vbs

This script sends key press events to the Skype client.

Copyright � 2004-2006 Skype Limited. Licensed under BSD license.

'// Create a Skype4COM object:
Set oSkype = WScript.CreateObject("Skype4COM.Skype","Skype_")

'// Start the Skype client:
If Not oSkype.Client.IsRunning Then oSkype.Client.Start() End If

'// Connect to the Skype API:
oSkype.Attach

'// Bring the Skype client into focus and open the Contacts tab:
oSkype.Client.Focus
oSkype.Client.OpenContactsTab()

'// Emulate typing "ECHO123" into the address bar of the Skype client (appears in the address bar or the Skype client): 
oSkype.Client.ButtonPressed "E"
oSkype.Client.ButtonReleased "E"
WScript.Sleep(1000)
oSkype.Client.ButtonPressed "C"
oSkype.Client.ButtonReleased "C"
WScript.Sleep(1000)
oSkype.Client.ButtonPressed "H"
oSkype.Client.ButtonReleased "H"
WScript.Sleep(1000)
oSkype.Client.ButtonPressed "O"
oSkype.Client.ButtonReleased "O"
WScript.Sleep(1000)
oSkype.Client.ButtonPressed "1"
oSkype.Client.ButtonReleased "1"
WScript.Sleep(1000)
oSkype.Client.ButtonPressed "2"
oSkype.Client.ButtonReleased "2"
WScript.Sleep(1000)
oSkype.Client.ButtonPressed "3"
oSkype.Client.ButtonReleased "3"
WScript.Sleep(1000)

'// Emulate pressing the Green (YES) button and the client starts a call:
oSkype.Client.ButtonPressed "YES"
oSkype.Client.ButtonReleased "YES"
WScript.Sleep(10000)

'// Emulate pressing the Red (NO) button and the client ends the call:
oSkype.Client.ButtonPressed "NO"
oSkype.Client.ButtonReleased "NO"

'// The AttachmentStatus event handler monitors attachment status and automatically attempts to reattach to the API following loss of connection:
Public Sub Skype_AttachmentStatus(ByVal aStatus)
  WScript.Echo ">Attachment status " & oSkype.Convert.AttachmentStatusToText(aStatus)
  If aStatus = oSkype.Convert.TextToAttachmentStatus("AVAILABLE") Then oSkype.Attach() End If
End Sub

Copyright � 2006 Skype Limited. All rights reserved.