FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH2310: WhatsApp messages with Attachments/Images
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
FWH2310: WhatsApp messages with Attachments/Images
Posted: Sun Oct 29, 2023 08:51 AM
FWH2310 provides facility to send WhatsApp messages with attachments of documents and images from any source.

fwh\samples\whatsapp.prg
Code (fw): Select all Collapse
#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


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 (fw): Select all Collapse
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
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Sun Oct 29, 2023 08:00 PM

Tested attaching Exe files also. The exe files received by the receiver are working properly.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Mon Oct 30, 2023 11:23 AM

Mr Rao,

Also Will be possible receive an answer and process it ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1
Joined: Mon Oct 30, 2023 06:47 PM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Mon Oct 30, 2023 06:49 PM

Congratulations, how does using WhatsApp work with Fivewin?

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Tue Oct 31, 2023 08:37 AM
vilian wrote:Mr Rao,
Also Will be possible receive an answer and process it ?
+1
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Wed Nov 01, 2023 12:03 AM
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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Wed Nov 01, 2023 12:08 AM
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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Wed Nov 01, 2023 06:55 AM
I wonder how this software is able to detect whether phone is linked to whatsapp or not
https://youtu.be/NYx9LcmPRhk?si=iFQsbGxVXQUpVacs
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: FWH2310: WhatsApp messages with Attachments/Images
Posted: Wed Nov 01, 2023 05:20 PM
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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion