![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
After a post from Robert asking if it is possible to send a SMS from Paradox,I have posted a solution to do this with skype in off-topics NG. As a lot of yours are not reading it I repost here. As I am "coding with my feet", feel free to correct it. ( To send a SMS with Skype seems to be a cheap solution in a lot of country) Régis Requirements: 1 - Skype 2.50 (or higher) Mine is 2.5.0.151 FREE 2 - A skype account ( Skype Out ) (note than charges to send a SMS are different from countries.with curious things. i.e. it is cheaper to send a SMS from France to USA, than from France to France) 3 - Have skype4com.dll installed on your computer FREE 4 - Visual Basic or Ponx FREE 5 - Windows 2000 or XP 6 - I use Paradox 10, (but no reason not working with P8,P9,P11, or Pdox X3) 1) To download skype: http://skype.com/download/ 2) To open a skype account : http://skype.com/products/skypeout/ 3) To download skype4com.dll : https://developer.skype.com/Docs/Skype4COM ( caution choose the beta release 1.0.0.21 ) Verify than the skype4com.dll file is installed at the correct directory: c:\windows\system32\ RUN REGISTER.BAT to activate the DLL 4) To Install Visual Basic : http://www.microsoft.com/downloads/d...DisplayLang=en To install Ponx : www.ponx.org/download/iso Now, you need to send a SMS test from skype to be correctly registered. And you are ready to send SMS with Paradox The code below is an exemple for sending SMS ; Code from a Skype VBS script for RDD personal use method pushButton(var eventInfo Event) var pseudoskype,sequence string sign, SMSText,st string userChoice string unit,a number tailleSMS,b smallint txt textstream ; VBS only px, pxd oleauto ; Ponx and Dynamic Ponx only endvar tailleSMS=160 sign="Régis" sign.view("Your signature here") SMSText="That is a SMS send with Paradox, Skype, and a VBScript. Done: "+string(today())+" at "+string(time())+"(sender time), by " SMSText.view("Entrer le texte du SMS") { WARNING, the SMS text must not contain CR/LF the code below, doesn't test this } pseudoskype="+33000000000" pseudoskype.view("Enter the phone number") { The phone number must be at international format i.e +1nnnnnnnnn for USA, +61nnnnnnnn for Australia, +33nnnnn for France .... charges are different from different countries. For further informations, see Skype Out help on www.skype.com } sequence=string(SMSText)+string(sign) for i from 1 to 5 a=smallint(sequence.size()) unit=ceil(a/tailleSMS) b=smallint(unit) if b=1 then ;msgInfo("Size/ Taille", "Length/Longueur: " + String(sequence.size()) + "\n\n\nSMS TEXT :\n\n"+ sequence+"\n\n") Dodefault else userChoice = msgYesNoCancel("Size/ Taille", "Text Length/Longueur du SMS: " + String(sequence.size()) + "\nis OVER "+string(tailleSMS)+" chars/ dépasse "+string(tailleSMS)+" caractères \n\nOUI, si vous voulez diminuer la longueur du texte."+ "\nNON cet envoi vous coutera "+string(b)+" SMS unitaires.("+string(b)+"*0,106 euro)\n\nYES to shorten SMS text"+ "\nNO this SMS text will cost "+string(b)+" SMS unit\n\n\nSMS TEXT :\n\n"+ sequence+"\n\n") switch case userChoice = "Yes" : ;msginfo("OUI","Essai "+ string (i)+"/5") sequence.view("Modify "+ string (i)+"/5 SMS Length: " + String(sequence.size())+" - Maxi= "+string(tailleSMS)) { Note than after the fifth trial, the SMS will be automatically sent,. Without warning the user. } case userChoice = "No" : Dodefault case userChoice = "Cancel" : Return endSwitch endif endfor ; // ******** This part is the VBS script part . ******** txt.open(workingdir()+"\\SMS-VBSript.VBS", "nw") ; open a new file txt.writeline("Set oSkype = WScript.CreateObject(\"Skype4COM.Skype\", \"Skype_\")") txt.writeline("If Not oSkype.Client.IsRunning Then oSkype.Client.Start() End If") txt.writeline("Set oSMS = oSkype.SendSms(\""+(pseudoskype)+"\", \""+(sequence)+"\")") txt.writeline("WScript.Sleep(100)") txt.close() execute("Wscript.exe \""+Workingdir()+"\\SMS-VBSript.VBS\"", Yes, ExeShowNormal) sleep() ; /// ******** End of the VBS script part msginfo("Information", "This SMS :\n\n"+string(sequence)+"\n\n has been sent to:\n"+string(pseudoskype)+"\nSMS Text Length : "+ String(sequence.size())) endMethod ************************************************** ********* if you use Ponx replace the VBS script part by this: ; // ******** To send a SMS with PONX . px.open("Ponx.Mci") st="sk=win32com.client.Dispatch('Skype4COM.Skype') osms = sk.SendSms('"+string(pseudoskype)+"','"+sequence+" ')" sleep() px.PRun(st) px.close() sleep() ; /// ******** End of PONX part And another solution is to use dynamic Ponx. Put this on the Form open method. px.open("Ponx.Mci") pxd.open("Ponxd.Mci") ;ouverture de Ponx dynamique px.PRun("def pxsms(numero, message): sk=win32com.client.Dispatch('Skype4COM.Skype') sk.SendSms(str(numero),message) ") pxd.recordpfunc("pxsms") ;//********* Then the Ponx part will be ********** pxd.pxsms(pseudoskype,sequence) ;// ********* End of the Dynamic Ponx part ************** |
![]() |
| Thread Tools | |
| Display Modes | |
| |