Sign in to follow this  
Followers 0
anixon

Converting 'C' to AutoIT

6 posts in this topic

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

;// 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
 $oSkype.Client.Start()
EndIf

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

;// 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
  $oSkype.Attach()
 EndIf
 If $aStatus = $oSkype.Convert.TextToAttachmentStatus("SUCCESS") Then
  MsgBox(0, "", "Current user is " & $oSkype.CurrentUserHandle)
 EndIf
EndFunc   ;==>Skype_AttachmentStatus

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

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

Sleep(5000)
_Sendsms()
Exit

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 4.2.0.187

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;
ismsmessage.Send();

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

Ant..

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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
    $ismsmessage.Send()
EndFunc   ;==>_SendSMS
Edited by jaberwocky6669

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Ant..

Edit: I just downloaded Skype Version 5.1.0.104 and your code converted from c++ works perfectly in both version 4.2.0.187 and 5.1.0.104. 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  
Followers 0