Help - Search - Members - Calendar
Full Version: Help with SKYPE4COMLib please
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
tapper_
Hi-

I am using the SKYPE4COMLib with C# and encountered 2 issues:

1) When I assign an integer to a Command.Id and send the command, I don't see that Id in the reply.

2) When I get the audio in or out device name using SKypeClass.Setting, I only get the 1st word of the device description. When I use the commands GET AUDIO_IN (or OUT), the full name is returned, but then I encounter the issue in 1) above.

Am I missing something with these issues? Thanks!!

- Tapper
andreskaasik_
Dear Tapper,

Thank you for the feedback. What version of Skype4COM.dll you use ? I tried to get the same errors with 1.0.0.2 (included in the Skype Contacts package) but without success.

I started the following script from command line and examined output, both the audio device names were correct and also command event handler parameter aCmd.Id was not null.

CODE
'// 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

WScript.Echo "Audio in ["& oSkype.Settings.AudioIn &"]"

WScript.Echo "Audio out ["& oSkype.Settings.AudioOut &"]"



'// Send the following non-blocking commands:

oSkype.SendCommand(oSkype.Command(0, "FOCUS"))

oSkype.SendCommand(oSkype.Command(11, "GET AUDIO_IN", "AUDIO_IN"))

oSkype.SendCommand(oSkype.Command(22, "GET AUDIO_OUT", "AUDIO_OUT"))

WScript.Sleep(1000)



'// Send the following blocking commands (note the True (blocking) variant for each command):

oSkype.SendCommand(oSkype.Command(33, "GET CURRENTUSERHANDLE", "CURRENTUSERHANDLE", True))

oSkype.SendCommand(oSkype.Command(44, "GET USER echo123 FULLNAME", "USER echo123 FULLNAME", True))

oSkype.SendCommand(oSkype.Command(55, "GET USER echo123 DISPLAYNAME", "USER echo123 DISPLAYNAME", True))

oSkype.SendCommand(oSkype.Command(66, "GET USER echo123 COUNTRY", "USER echo123 COUNTRY", True))

WScript.Sleep(1000)



'//As with command objects, search commands can be defined as blocking or non-blocking, and the default value is False, non-blocking. A blocking search requires a response before activities continue. Following is a blocking search (note the True (blocking) variant:

Set oBlockingSearch = oSkype.Command(8888, "SEARCH USERS echo123", "USERS ", True)

oSkype.SendCommand(oBlockingSearch)

WScript.Echo "Search Result:" & oBlockingSearch.Reply



'//A non-blocking search does not require a response:

Set oSearchCommand = oSkype.Command(9999, "SEARCH USERS john doe", "USERS ")

oSkype.SendCommand(oSearchCommand)



WScript.Echo "Sleeping ..."

WScript.Sleep(30000)



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



Public Sub Skype_Command(ByRef aCmd)    

 WScript.Echo "C(" & aCmd.Id & "): " & aCmd.Command  

End Sub



Public Sub Skype_Reply(ByRef aCmd)

 WScript.Echo "R(" & aCmd.Id & "): " & aCmd.Reply  

End Sub


For example the output for audio devices follows:

CODE
C:Program FilesSkypeActiveXContacts>cscript test.vbs

Microsoft (R) Windows Script Host Version 5.6

Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.



C(1): PROTOCOL 5

R(0): CURRENTUSERHANDLE andreskaasik

R(0): USERSTATUS ONLINE

R(1): PROTOCOL 5

C(2): GET SKYPEVERSION

R(2): SKYPEVERSION 2.5.0.86

>Attachment status Ühendatud

C(3): #3 GET AUDIO_IN

R(3): #3 AUDIO_IN SigmaTel Audio

Audio in [SigmaTel Audio]

C(4): #4 GET AUDIO_OUT

R(4): #4 AUDIO_OUT SigmaTel Audio

Audio out [SigmaTel Audio]

Sleeping ...
tapper_
Thank you so much for your reply. Yes, I'm using the same version. I wrote a simple program and the Settings.AudioIn WORKS - as long as I don't do it within an event handler, which causes an exception. I'll double-check the real program to see what the heck is going on there.

But I still have the Id issue in my simple program. First, before I even send my commands, I get about the send commands/replies that are are shown in the output of your example. My guess is that they are automatic standard commands/replies during the attachment or ?? And the Id's are pre-defined??

I'm not familiar enough with scripts to know the structure of SendCommand parameters - I assume that you are assigning Command.Id's of 11,22,33, ... But I don't see any of those numbers in the list of command/replies in the output. Do I understand those numbers wrong?

In my simple app (which I'll be glad to send (it's a bit long, sorry)) I setup 2 event handlers, one for the command event and one for the reply event, just as in your example. I can see my assigned Command.Id's showing up in the command handler, but I still always get 0's in the reply handler.

Does that all makes sense - shall I send my simple app? Thanks!!

Best wishes,

Tapper
tapper_
Hi again -

I took another look at both my test app and my app - and here's what appears to be going on:

If I look at the value of Settings.AudioIn, the first time it gives the full name. BUT if I check the value again, it only gives the first word. I checked the value 5 times, one right after the other, and that's what I saw.

I wish I knew more about scripts to try it in your example.

Thanks!!

Best wishes,

Tapper
andreskaasik_
Hello. Found the bug that causes AUDIO_IN and AUDIO_OUT to be truncated. The temporary workaround is to switch the command cache off before asking for audio device names:

CODE
'// 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



oSkype.Cache = False



WScript.Echo "AudioIn [" & oSkype.Settings.AudioIn & "]"

WScript.Echo "AudioIn [" & oSkype.Settings.AudioIn & "]"



WScript.Echo "AudioOut [" & oSkype.Settings.AudioOut & "]"

WScript.Echo "AudioOut [" & oSkype.Settings.AudioOut & "]"



Public Sub Skype_Command(ByRef aCmd)    

 WScript.Echo "C(" & aCmd.Id & "): " & aCmd.Command  

End Sub



Public Sub Skype_Reply(ByRef aCmd)

 WScript.Echo "R(" & aCmd.Id & "): " & aCmd.Reply

End Sub
tapper_
Great!! Thank you!!

Is the Command.Id still an open issue or am I missing something there? I think if I can get the audio settings, I may not need the command/reply Id's right away, but it would be nice to know how to use it for the future. So it's a low-prority issue for me I think.

Best wishes,

Tapper
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.