kapiaba Posted January 9, 2018 Report Share Posted January 9, 2018 Só não entendi a parte do SMS. #include "FiveWin.ch" static oWnd function Main() local oBar, t_sms, t_mess local cPhone, cNome, cComment, CodeCountry cPhone := "11951577341" cNome := "Joao@xxxxx.com.br" cComment := "Mensagem de natal e ano novo" CodeCountry := "55" t_sms := "xxxxxxxxxxx" t_mess := "Mensagem via skype" DEFINE WINDOW oWnd TITLE "Chamando Skype" DEFINE BUTTONBAR oBar _3D OF oWnd DEFINE BUTTON OF oBar ; ACTION PhoneTO( cPhone, cNome, cComment, CodeCountry ) // ACTION EnviaSms( t_sms, cnome, t_mess, CodeCountry ) SET MESSAGE OF oWnd TO "Chamando Skype" NOINSET CLOCK DATE KEYBOARD ACTIVATE WINDOW oWnd return nil FUNCTION PhoneTO( cPhone, cNome, cComment, CodeCountry ) Local oSkype,oCall,oUser // DEFAULT CodeCountry := CountryCode() if empty(cPhone) ? "Telefone nao valido" return 0 endif //if its a user do nothing if val(cPhone) <>0 //phone number build format cPhone := alltrim(cPhone) // in the databse all international numbers have 00 //it must be taken out if substr(cPhone,1,2) == "00" cPhone := substr(cPhone,3) else //all others are national numbers code country must be added cPhone := CodeCountry+cPhone endif cPhone :="+"+cPhone endif Try oSkype := GetActiveObject("Skype4COM.Skype") Catch Try oSkype := CreateObject("Skype4COM.Skype") Catch alert("Skype4Com não está instalado!"+; ";"+ole2txterror()) return 0 End End If .not. oSkype:Client:IsRunning() MsgRun("Informação","Activando o Skipe",{||oSkype:Client:Start()}) Endif //not online if oSkype:CurrentUserStatus <> oSkype:Convert:TextToUserStatus("ONLINE") //lets pout it on line oSkype:changeUserStatus(oSkype:Convert:textToUserStatus("ONLINE")) endif Try oUser:= oSkype:user(cPhone) oCall := oSkype:PlaceCall(oUser:Handle) Catch MsgInfo("Chamada falhada! Telefone: "+cPhone) return 0 End oSkype := Nil RETURN 1 FUNCTION EnviaSms(t_sms,cnome,t_mess,CodeCountry) Local oSkype,oSMS,oTarget,oChunk,oCall,oUser // DEFAULT CodeCountry := CountryCode() if empty(t_sms) return 0 endif //if its a user do nothing if val(t_sms) <>0 //phone number build format t_sms := alltrim(t_sms) // in the databse all international numbers have 00 //it must be taken out if substr(t_sms,1,2) == "00" t_sms := substr(t_sms,3) else //all others are national numbers code country must be added t_sms := CodeCountry+t_sms endif t_sms :="+"+t_sms endif //format message t_mess := alltrim(t_mess) t_mess := strtran(t_mess,"",chr(12)+CHR(13)) t_mess := strtran(t_mess,"",CHR(13)) t_mess := strtran(t_mess,"",chr(26)) Try oSkype := GetActiveObject("Skype4COM.Skype") Catch Try oSkype := CreateObject("Skype4COM.Skype") Catch alert("Skype4Com não está instalado!"+; ";"+ole2txterror()) return 0 End End If .not. oSkype:Client:IsRunning() MsgRun("Informação","Activando o Skip",{||oSkype:Client:Start()}) Endif //not online if oSkype:CurrentUserStatus <> oSkype:Convert:TextToUserStatus("ONLINE") //lets pout it on line oSkype:changeUserStatus(oSkype:Convert:textToUserStatus("ONLINE")) endif Try oUser:= oSkype:user(t_sms) oSMS := oSkype:SendSms(oUser:Handle, t_mess) // generic Catch msginfo("Não foi possivel enviar o SMS!") return 0 End MsgWait( "A aguardar confirmação de envio da sms para: "+t_sms, "Skype SMS", 10 ) If oSms:Status()<>5 // not delivered ? Msginfo("O envio da SMS pode ter falhado! ") return 0 // erro SMS Endif oSkype := Nil RETURN 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.