FUNCTION WHATS_APP_GO_DIRECT(f_cPhoneNumber,f_cMessage,f_cFileSend,f_cCountryCode)
Local lc_cCommandStart := ""
Local lc_cCommandTxt := ""
Local lc_cCommandFile := ""
Local lc_oClipBoard
Local lc_hWndWhats
Local lc_oShellScr
Local lc_oShellFolder
Local lc_iFor := 0
Default f_cMessage := "", f_cFileSend := "", f_cCountryCode := "55"
lc_cCommandStart := "whatsapp://send?phone=_cPhoneNumber_"
lc_cCommandTxt := "whatsapp://send?phone=_cPhoneNumber_&text=_cMessage_"
lc_cCommandFile := Hb_DirBase()+"file2clip.exe _cFileSend_"
f_cPhoneNumber := StrTran(f_cPhoneNumber," ","")
f_cPhoneNumber := StrTran(f_cPhoneNumber,"(","")
f_cPhoneNumber := StrTran(f_cPhoneNumber,")","")
f_cPhoneNumber := StrTran(f_cPhoneNumber,",","")
f_cPhoneNumber := StrTran(f_cPhoneNumber,"-","")
f_cPhoneNumber := StrTran(f_cPhoneNumber,".","")
f_cPhoneNumber := StrTran(f_cPhoneNumber,"+"+f_cCountryCode,"")
f_cPhoneNumber := StrTran(f_cPhoneNumber,"+","")
f_cPhoneNumber := f_cCountryCode+f_cPhoneNumber
f_cMessage := StrTran(f_cMessage,CRLF,"%0A")
f_cMessage := StrTran(f_cMessage," ","%20")
f_cMessage := StrTran(f_cMessage,"&","%26")
f_cMessage := StrTran(f_cMessage,chr(13),"%0D%0A")
If !Empty(f_cFileSend)
f_cFileSend := Lfn2Sfn(f_cFileSend)
f_cFileSend := chr(34)+f_cFileSend+chr(34)
EndIf
lc_cCommandStart := StrTran(lc_cCommandStart,"_cPhoneNumber_",f_cPhoneNumber)
lc_cCommandTxt := StrTran(lc_cCommandTxt,"_cPhoneNumber_",f_cPhoneNumber)
lc_cCommandTxt := StrTran(lc_cCommandTxt,"_cMessage_",f_cMessage)
lc_cCommandFile := StrTran(lc_cCommandFile,"_cFileSend_",f_cFileSend)
ShellExecute(0,"open",lc_cCommandStart)
syswait(2)
lc_hWndWhats := FindWindow(,"WhatsApp")
if hb_IsNil(lc_hWndWhats)
MsgStop("WhatsApp não esta carregado.","Procedimento abortado.")
Return .F.
Else
if lc_hWndWhats == 0
MsgStop("WhatsApp não esta carregado.","Procedimento abortado.")
Return .F.
Else
BringWindowToTop( lc_hWndWhats )
SysWait(.3)
EndIf
EndIf
//? lc_cCommandTxt
lc_oShellScr := tOleAuto():New( "WScript.Shell" )
If !Empty(f_cMessage)
ShellExecute(0,"open",lc_cCommandTxt)
syswait(.5)
lc_oShellScr:SendKeys( "~" )
EndIf
//? lc_cCommandFile
If !Empty(f_cFileSend)
WaitRun(lc_cCommandFile,0)
syswait(.4)
lc_oShellScr:SendKeys( "^v" )
syswait(1)
lc_oShellScr:SendKeys( "~" )
syswait(.5)
EndIf
RETURN NIL