Page 1 of 1

whatsapp

PostPosted: Fri Nov 17, 2023 8:44 pm
by russimicro
Buena tarde... tengo la versión 23.05... es posible obtener la clase whatpSapp, mencionada en la última version de fwh---
Gracias

JONSSON RUSSI

Re: whatsapp

PostPosted: Sun Nov 19, 2023 2:44 am
by nageswaragunupudi
The function provided with FWH2310 can send files as attachments. That is possible only due to some low level ( c language modules ) in FWH2310. So, that is not compatible with earlier versions.

We provide here a modified version with which we can send messages and also some images optionally. This works with FWH2304.

Code: Select all  Expand view
// whatsapp app must be installed and opened before running this code

#include "FiveWin.ch"

#define ORANGES "https://www.jesmondfruitbarn.com.au/wp-content/uploads/2016/10/Jesmond-Fruit-Barn-Oranges.jpg"

function Main()

   local cPhone   := ""
   local cMsg     := "Hello"

   if EDITVARS cPhone, cMsg
      SendToWhatsApp( AllTrim( cPhone ), AllTrim( cMsg ), ;
         { "..\bitmaps\007.bmp", ORANGES, ;
            "https://www.google.co.in/" } )
   endif

return nil


function SendToWhatsApp( cPhone, cMsg, aAttach )

   local oShell, hBmp
   local aSend := {}

   if Empty( cPhone ); return .f.; endif

   DEFAULT cMsg := "Hello"

   if !Empty( aAttach )
      if !HB_ISARRAY( aAttach ); aAttach := { aAttach }; endif
      AEval( aAttach, <|c,i|
         if HB_ISSTRING( c )
            if !Empty( hBmp := FW_ReadImage( nil, c, , .t. )[ 1 ] )
               AAdd( aSend, hBmp )
            else
               AAdd( aSend, CRLF + c )
            endif
         endif
         return nil
         > )
   endif

   cMsg  := StrTran( cMsg, CRLF, "%0D%0A" )

   oShell := CreateObject( "WScript.Shell" )
   ShellExecute( 0, "Open", "whatsapp://send?phone="+cPhone+"&text="+cMsg )
   SysWait( 0.5 )


   AEval( aSend, <|u|
      if FW_CopyToClipBoard( u )
         SysWait( 1 ); oShell:SendKeys( "^v" ); SysWait( 1 )
      endif
      return nil
      > )

   oShell:SendKeys("~")

return nil


You are welcome to make any improvements.
With this we can send weblinks also.

We need to install WhatsApp application and install and open it.

Re: whatsapp

PostPosted: Sun Nov 19, 2023 9:19 am
by jnavas
hBitmap = NViewLib32( cBmpFile , 1 )
Vs
FW_ReadImage( nil, cBmpFile, , .t. )

Re: whatsapp

PostPosted: Mon Nov 20, 2023 1:13 pm
by nageswaragunupudi
We do not know other libraries
But FWH's FW_ReadImage() is very powerful than any.

Re: whatsapp

PostPosted: Wed Nov 22, 2023 8:48 am
by jnavas
Saludos buen dia y gracias.
Tengo aplicación con FW 2.4 con usuarios en producción y tiene personalizaciones, para este caso necesito copiar la Imagen hacia el clipboard del OS, cuento con la funcion NViewLib32( cBmpFile , 1 ) que devuelve un valor numérico. Necesito copiar la imagen hacia el clibboard del OS.
Igualmente posee FW actualizado y estamos compilando el nuevo binario

Re: whatsapp

PostPosted: Wed Nov 22, 2023 1:09 pm
by jnavas
Saludos y gracias a la ayuda de jose Alberto alvares, voy a validar con METHOD CopyToClipboard() CLASS TBitmap

local oClipboard := TClipboard():New( CF_BITMAP )

oClipboard:SetBitmap( Self )

oClipboard:End()

return nil

Re: whatsapp

PostPosted: Thu Nov 23, 2023 12:22 pm
by russimicro
Buen día...

Funciona perfecto... pero tengo necesidad de enviar PDF... La idea es generar una factura y dar la opción de enviar a whatsApp.

Gracias

Re: whatsapp

PostPosted: Thu Nov 23, 2023 2:38 pm
by nageswaragunupudi
If you have FWH2310, you can send images and any files as attachments, pdf, etc

Re: whatsapp

PostPosted: Sat Nov 25, 2023 3:53 pm
by russimicro
Buen dia..

He actualizado a la fwh 23.10 y funciona perfecto....

Gracias

Re: whatsapp

PostPosted: Sat Nov 25, 2023 5:12 pm
by nageswaragunupudi
If you are using FWH2310, please see fwh\samples\whatsapp.prg
Use the function given in that sample program, but not the program I posted above.