Jump to content

skype + au3 help


joseLB
 Share

Recommended Posts

I posted a tread with an idea on how to solve with au3 the skype problem of to not send a message when both parties are not logged in.

http://www.autoitscript.com/forum/index.php?showtopic=40434

question: do that, I need to know how to access skype API and send commands to it, as up to now nobody is candidate to make this program. Can you help with some examples and/or explanation?

Jose

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 10 months later...

I posted a tread with an idea on how to solve with au3 the skype problem of to not send a message when both parties are not logged in.

http://www.autoitscript.com/forum/index.php?showtopic=40434

question: do that, I need to know how to access skype API and send commands to it, as up to now nobody is candidate to make this program. Can you help with some examples and/or explanation?

Jose

Jose asked this question nearly a year ago. Apparently, at the time, nos sample scripts were made available. I still think that this is a very interesting topic. Can anyone please help with a sample script?
Link to comment
Share on other sites

@All

It's not what you need but it's a start.

; Skype MultiUser Chat

; Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype") 

If Not $oSkype.Client.IsRunning Then 
    $oSkype.Client.Start() 
EndIf


; Create a UserCollection object and add the multichat users to this collection:
$oMembers = ObjCreate("Skype4COM.UserCollection")
$oMembers.Add($oSkype.User("skypeuser1"))
$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.Leave

regards

ptrex

Link to comment
Share on other sites

@All

It's not what you need but it's a start.

; Skype MultiUser Chat

; Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype") 

If Not $oSkype.Client.IsRunning Then 
    $oSkype.Client.Start() 
EndIf


; Create a UserCollection object and add the multichat users to this collection:
$oMembers = ObjCreate("Skype4COM.UserCollection")
$oMembers.Add($oSkype.User("skypeuser1"))
$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.Leave

regards

ptrex

Thank you very much, ptrex. I am new to Autoit and, and frankly, I am also new to object oriented programming. I am old and oldfashioned. But I am still trying to learn and your example will help me to learn. And it will certainly keep me busy for a while. Thanks again.

TomTomTom

Link to comment
Share on other sites

Sorry to bother (and possibly bore) again. I have been reading: https://developer.skype.com/Docs/ApiDoc/Skype_API_on_Windows. Just one page, I have copied/pasted it below. I have trying to implement this in Skype. It is rather basic, I think. It is about sending/receiving messages to and from Skype. I imagine that it can be done trough Autoit functions such as DLLCall or other AutoIT functions? Would anybody help me please? Thank you in advance. Tomtomtom.

This is the text from the "skype developer zone":

Skype API on Windows

When developing applications to work with Skype, follow these general guidelines:

Give intuitive names to executable files (.exe files) because this name is displayed to the user for confirmation. If the name is unclear, the user might not allow the application to access Skype.

Sign applications with VeriSign's CodeSigning certificate.

The application must support the NAME command and publish its name.

Skype for Windows sends and receives API commands using WM_COPYDATA messages. Use the RegisterWindowMessage method to register the following messages:

SkypeControlAPIDiscover

SkypeControlAPIAttach

To initiate communication, a client application broadcasts the SkypeControlAPIDiscover message, including its window handle as a wParam parameter. Skype responds with a SkypeControlAPIAttach message to the specified window and indicates the connection status with one of the following values:

SKYPECONTROLAPI_ATTACH_SUCCESS = 0 - The client is attached and the API window handle is provided in wParam parameter.

SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION = 1 - Skype acknowledges the connection request and is waiting for user confirmation. The client is not yet attached and must wait for the SKYPECONTROLAPI_ATTACH_SUCCESS message.

SKYPECONTROLAPI_ATTACH_REFUSED = 2 - The user has explicitly denied access to client.

SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE = 3 - The API is not available at the moment, for example because no user is currently logged in. The client must wait for a SKYPECONTROLAPI_ATTACH_API_AVAILABLE broadcast before attempting to connect again.

When the API becomes available, Skype broadcasts the SKYPECONTROLAPI_ATTACH_API_AVAILABLE = 0x8001 message to all application windows in the system. The data exchange uses commands (or responses), provided as null-terminated UTF-8 strings. The terminating 0 must be transferred as well. You cannot combine several messages in one packet. There is no limit to the length of the transferred string.

Note: The result of processing the message must be different from zero (0), otherwise Skype considers that the connection broken.

If the API client spends more than 1 second processing a message, the connection is disconnected. Use the PING command to test the connection status. To ease debugging during development, in regedit enter the key APITimeoutDisabled (DWORD value, 0 = timeout enabled 1 = timeout disabled) into the HKCU\Software\Skype\Phone\UI file in the registry to override the 1 second timeout.

To check if Skype is installed, in regedit check if the following key exists: HKCU\Software\Skype\Phone, SkypePath . This key points to the location of the skype.exe file . If this key does not exist, check if the HKLM\Software\Skype\Phone, SkypePath key exists. If the HKCU key does not exist but the HKLM key is present, Skype has been installed from an administrator account but not been used from the current account.

Link to comment
Share on other sites

At the cost of some sweat, I think that I have found a partial answer to my own question. See the code below. My script now actually talks to Skype. I can see that, because Skype is asking permission to interact with my AutoIt program. However: this is only a beginning. Can somebody please give me a hint about the next step? Skype is supposed to return a SkypeControlAPIAttach message. How can I detect that that has actually happened? Please?

This is my script so far:

CODE

#include <misc.au3>

#include <constants.au3>

#include <GUIConstants.au3>

Const $HWND_BROADCAST = 0xFFFF

$gui = GUICreate("Sender", 300, 150)

GUISetState()

$SkypeControlAPIDiscover = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', "SkypeControlAPIDiscover")

$SkypeControlAPIDiscover = $SkypeControlAPIDiscover[0]

$SkypeControlAPIAttach = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', "SkypeControlAPIAttach")

$SkypeControlAPIAttach = $SkypeControlAPIAttach[0]

$hwndS = WinGetHandle("Sender")

DllCall("user32.dll","int","SendMessage","hwnd",$HWND_BROADCAST , "int",$SkypeControlAPIDiscover,"int",$hwndS, "int",0)

Link to comment
Share on other sites

A step forward: now I get a response from Skype.

See the code below.

Not even a tiny step for mankind but a major triumph for me!

I'll stop boring you with this now. Thanks for reading all this.

Tom

CODE
#include <misc.au3>

#include <constants.au3>

#include <GUIConstants.au3>

Const $HWND_BROADCAST = 0xFFFF

$gui = GUICreate("Sender", 300, 150)

$SkypeControlAPIDiscover = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', "SkypeControlAPIDiscover")

$SkypeControlAPIDiscover = $SkypeControlAPIDiscover[0]

;

$SkypeControlAPIAttach = DllCall('user32.dll', 'int', 'RegisterWindowMessage', 'str', "SkypeControlAPIAttach")

$SkypeControlAPIAttach = $SkypeControlAPIAttach[0]

;

Run("C:\Program Files\Skype\Phone\Skype.exe")

WinWaitActive("Skype")

$hwnd = WinGetHandle("Skype")

;

$Ret = DllCall("user32.dll","int","SendMessage","hwnd",$HWND_BROADCAST , "hwnd",$SkypeControlAPIDiscover,"hwnd",$gui, "int",0)

;

;

;

GUIRegisterMsg($SkypeControlAPIAttach,"attach")

GUISetState()

;

While GUIGetMsg() <> $GUI_EVENT_CLOSE

wend

exit

;

;

func attach()

MsgBox("1","attached", "attached")

EndFunc

Link to comment
Share on other sites

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...