Jump to content
Sign in to follow this  

Converting 'C' to AutoIT

Recommended Posts

This code will send a Skype SMS's provided that you are running Skype Version

;// Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype")
$oSkypeEvent = ObjEvent($oSkype, "Skype_")
$oError = ObjEvent("AutoIt.Error", "MyErrFunc")

;// Start the Skype client:
If Not $oSkype.Client.IsRunning Then

;// Verify that a user is signed in and online before continuing
While 1
 If $oSkype.CurrentUserStatus = $oSkype.Convert.TextToUserStatus("ONLINE") Then

;// The AttachmentStatus event handler monitors attachment status and returns the Skypename of the user when the status is "success":
Func Skype_AttachmentStatus($aStatus)
 MsgBox(0, "", "Attachment status " & $oSkype.Convert.AttachmentStatusToText($aStatus))
 If $aStatus = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE") Then
 If $aStatus = $oSkype.Convert.TextToAttachmentStatus("SUCCESS") Then
  MsgBox(0, "", "Current user is " & $oSkype.CurrentUserHandle)
EndFunc   ;==>Skype_AttachmentStatus

Func _SendSMS()
  Local $MyMobileNumber = "+61401523364";
  Local $MyMessageText = "This is a test SMS";
  $oSms = $oSkype.SendSms($MyMobileNumber, $MyMessageText, "")
EndFunc   ;==>_SendSMS

Func MyErrFunc()
 ;Do Nothing
EndFunc   ;==>MyErrFunc


In Skype Version 5.n the reply to number which is attribute 3 in $oSkype.SendSMS is no longer supported and fails when its being composed by Skype even if this attribute is set to null or omitted as per this example:

$oSms = $oSkype.SendSms($MyMobileNumber, $MyMessageText)

As a matter of interest both examples work in Skype Version

I have been informed that the work around for Skype version 5.nn is not to use $oSkype.SendSms to send an SMS rather the following code which is written in'C'

; / / Change this telephone number To a vaild one
String MySmsNumber = "+16515551212";
String MySMStext = "This is a test message";
ISmsMessage ismsmessage = skype.CreateSms(TSmsMessageType.smsMessageTypeOutgoing, MySmsNumber);
ismsmessage.Body = MySMStext;

Unfortunately I have no experience with 'C' and was hoping that an AutoIT subscriber could help me by converting the code so that it will run when calling Func _SendSMS()

Replies are always appreciated Ant.. :)

Share this post

Link to post
Share on other sites

Really it's c++ and you'll need to find out more about TSmsMessageType to proceed, I think.

According to the Skype4Com Documentation

enum TSmsMessageType {

smsMessageTypeUnknown = -1, smsMessageTypeIncoming = 0, smsMessageTypeOutgoing = 1, smsMessageTypeCCRequest = 2,

smsMessageTypeCCSubmit = 3


I hope that is helpful


Share this post

Link to post
Share on other sites

No guarantees because I'm hacking away blindly but give this a shot.

Enum $smsMessageTypeUnknown = -1, $smsMessageTypeIncoming, $smsMessageTypeOutgoing, $smsMessageTypeCCRequest, $smsMessageTypeCCSubmit

Func _SendSMS()
    Local $MyMobileNumber = "+61401523364" ; Change this telephone number To a vaild one
    Local $MyMessageText = "This is a test SMS"
    Local $ismsmessage = $oSkype.CreateSms($smsMessageTypeOutgoing, $MyMobileNumber)
    $ismsmessage.Body = $MyMessageText
EndFunc   ;==>_SendSMS
Edited by jaberwocky6669

Share this post

Link to post
Share on other sites

Absolutely brilliant worked exactly as required in Skype version now for the moment of truth does it work in Skype version 5.nn give me 10 mins and I will let you know


Edit: I just downloaded Skype Version and your code converted from c++ works perfectly in both version and I have been working on trying to find a solution to this issue Skype 5.nn issue since November last and to tell you the truth it has been a bit frustrating. The fact that you have been able to help with converting the c++ to AutoIT is not only terrific help to me but my guess to all other AutoIT subscribers that have been working with the Skype API 'Skype4Com' Thank you again - YHS Ant. Posted Image.

Edited by anixon

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...