FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Whatsapp
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Whatsapp
Posted: Sun Jun 29, 2025 12:16 PM

Thank you, we will try it. What is "WhatsApp - Escritorio"?

Posts: 410
Joined: Sun Jan 31, 2010 03:30 PM
Re: Whatsapp
Posted: Sun Jun 29, 2025 02:15 PM
App local .. como cualquier app nuestra para plataforma windows----

la otra opcion es como un servicio web

https://www.whatsapp.com/download?lang=es
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Whatsapp
Posted: Sun Jun 29, 2025 07:05 PM

Ah, ok, the normal Whatsapp app for Windows, thank you.

Posts: 253
Joined: Wed May 25, 2016 01:04 AM
Re: Whatsapp
Posted: Mon Jun 30, 2025 01:42 PM
russimicro wrote: Buen día..

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

//********************************************
Hola, funciona muy bien. ¿Se puede enviar a un grupo de WhatsApp? Gracias.
Posts: 22
Joined: Thu Apr 23, 2020 12:41 PM
Re: Whatsapp
Posted: Sat Sep 06, 2025 04:42 PM

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.

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Whatsapp
Posted: Sun Sep 07, 2025 07:17 AM

FindWindow/PostMessage WM_CLOSE

Posts: 22
Joined: Thu Apr 23, 2020 12:41 PM
Re: Whatsapp
Posted: Wed Sep 10, 2025 06:49 PM

Thank you very much, Otto.

Continue the discussion