Skype4COM 1.0.36.0
|
Attach.vbs
This script listens for connections on the Skype API, connects when available, and holds the skypename of the user when a connection is successful.
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 with protocol version 5 (the default version): oSkype.Attach 5 '// When attached to the API, send repeated commands to the API to test if they succeed: Do While True WScript.Sleep(1000) If oSkype.AttachmentStatus = oSkype.Convert.TextToAttachmentStatus("SUCCESS") Then WScript.StdOut.Write "PING.." oSkype.SendCommand(oSkype.Command(0, "PING","PONG",TRUE)) 'oSkype.SendCommand(oSkype.Command(0, "PING")) WScript.StdOut.Write "ok" WScript.Echo "" End If Loop '// The AttachmentStatus event handler monitors attachment status and returns the Skypename of the user when the status is "success": 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 If aStatus = oSkype.Convert.TextToAttachmentStatus("SUCCESS") Then WScript.Echo "Current user is " & oSkype.CurrentUserHandle End If End Sub
Copyright � 2006 Skype Limited. All rights reserved.