Thank you, we will try it. What is "WhatsApp - Escritorio"?
Thank you, we will try it. What is "WhatsApp - Escritorio"?
Ah, ok, the normal Whatsapp app for Windows, thank you.
russimicro wrote: Buen dÃa..Hola, funciona muy bien. ¿Se puede enviar a un grupo de WhatsApp? Gracias.
Este Código me funciona --- TOMADO DEL FORO
// REQUIERE VERSION WhatsApp - Escritorio FUNCTION PRUEBA__WhatsApp() LOCAL cPhone := "57"+"325874510" // NO HACER PRUEBAS CON EL MISMO NUMERO DE QUIEN ENVIA LOCAL cMenEnv := "Anexo factura de venta en formato PDF" LOCAL cNomFil := "e:\temp\FACTURA_SP1012.PDF" enviaLinkWhatsApp(ALLTRIM(cPhone),cMenEnv,cNomFil) RETURN //*********************************************************** function enviaLinkWhatsApp(cPhone,cMsg,cFilPdf) LOCAL aImgEnv := {} IF !FILE(cFilPdf) ALERTA("Aviso. Archivo a transferir no existe : "+cFilPdf) ENDIF IF cFilPdf <> NIL .AND. !EMPTY(cFilPdf) aImgEnv := {cFilPdf} ENDIF IF !EMPTY(cPhone) _SendToWhatsApp( AllTrim( cPhone ), AllTrim( cMsg ), aImgEnv ) ELSE ALERTA("Aviso. Falto el n£mero para WhatSapp ") ENDIF return nil //**************************************************** function _SendToWhatsApp( cPhone, cMsg, aAttach ) local oShell local aFiles := {} local aOthers := {} if Empty( cPhone ); return .f.; endif DEFAULT cMsg := "Hello" if !Empty( aAttach ) if !HB_ISARRAY( aAttach ); aAttach := { aAttach }; endif AEval( aAttach, {|c| if( HB_ISSTRING( c ) .and. File( c ), ; AAdd( aFiles, c ), AAdd( aOthers, c ) ) } ) endif cMsg := StrTran( cMsg, CRLF, "%0D%0A" ) oShell := CreateObject( "WScript.Shell" ) ShellExecute( 0, "Open", "whatsapp://send?phone="+cPhone+"&text="+cMsg ) SysWait( 0.2 ) if !Empty( aFiles ) if FW_CopyToClipBoard( aFiles, 15 ) SysWait( 2 ); oShell:SendKeys( "^v" ); SysWait( 1 ) endif endif AEval( aOthers, <|u| if FW_CopyToClipBoard( u, 2 ) .or. FW_CopyToClipBoard( u ) SysWait( 1 ); oShell:SendKeys( "^v" ); SysWait( 1 ) endif return nil > ) SysWait( 1 ) oShell:SendKeys("~") return nil //********************************************
Hi, I tried using the program, but I could only send messages; attachments didn't arrive. No errors were reported; messages simply arrived without attachments. I'd also like to know if it's possible to automatically close the WhatsApp window that opens when you send a message. Thanks.
FindWindow/PostMessage WM_CLOSE
Thank you very much, Otto.