Page 1 of 1

FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Sun Oct 29, 2023 8:51 am
by nageswaragunupudi
FWH2310 provides facility to send WhatsApp messages with attachments of documents and images from any source.

fwh\samples\whatsapp.prg
Code: Select all  Expand view
#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 ), ;
         { "pdfharu1H.pdf", ;       // document file
           "..\bitmaps\007.bmp", ;  // image file
           ORANGES, ;               // web image
           "https://forums.fivetechsupport.com/" ; // url ref
         } )
   endif

return nil


Image

Images from files and web (can be images from any source ) are displayed as images in the message body and other documents as attachments. Url refs are shown as url refs.

Code: Select all  Expand view
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.5 )

   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
      > )

   oShell:SendKeys("~")

return nil

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Sun Oct 29, 2023 8:00 pm
by nageswaragunupudi
Tested attaching Exe files also. The exe files received by the receiver are working properly.

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Mon Oct 30, 2023 11:23 am
by vilian
Mr Rao,
Also Will be possible receive an answer and process it ?

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Mon Oct 30, 2023 6:49 pm
by mgasistemas
Congratulations, how does using WhatsApp work with Fivewin?

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Tue Oct 31, 2023 8:37 am
by Silvio.Falconi
vilian wrote:Mr Rao,
Also Will be possible receive an answer and process it ?


+1

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Wed Nov 01, 2023 12:03 am
by nageswaragunupudi
vilian wrote:Mr Rao,
Also Will be possible receive an answer and process it ?


Sorry, No.
Possible with WhatsApp Business account, which is also free.
But we did not make any efforts to use it from Fivewin.

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Wed Nov 01, 2023 12:08 am
by nageswaragunupudi
mgasistemas wrote:Congratulations, how does using WhatsApp work with Fivewin?


Working well.
But I noticed one problem which we could not solve till now.
If we want to send message with attachments to a particular contact and if we already have the chat window open with the same contact, this function is not working satisfactorily.
Otherwise this is working well.

For example, I am chatting with you and my chat window is open with you, I am unable to use this function to send message with attachments to You, but I can send to any other contact.
We will improve once our users start using and provide feedback.

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Wed Nov 01, 2023 6:55 am
by hua
I wonder how this software is able to detect whether phone is linked to whatsapp or not
https://youtu.be/NYx9LcmPRhk?si=iFQsbGxVXQUpVacs

Re: FWH2310: WhatsApp messages with Attachments/Images

PostPosted: Wed Nov 01, 2023 5:20 pm
by Silvio.Falconi
hua wrote:I wonder how this software is able to detect whether phone is linked to whatsapp or not
https://youtu.be/NYx9LcmPRhk?si=iFQsbGxVXQUpVacs

Probabile use a bot, you can use a bot with telegram there Is a class for fwh