FWH2310: WhatsApp messages with Attachments/Images

FWH2310: WhatsApp messages with Attachments/Images

Postby nageswaragunupudi » Sun Oct 29, 2023 8:51 am

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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby nageswaragunupudi » Sun Oct 29, 2023 8:00 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby vilian » 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
User avatar
vilian
 
Posts: 977
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby mgasistemas » Mon Oct 30, 2023 6:49 pm

Congratulations, how does using WhatsApp work with Fivewin?
mgasistemas
 
Posts: 1
Joined: Mon Oct 30, 2023 6:47 pm

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby Silvio.Falconi » Tue Oct 31, 2023 8: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby hua » Wed Nov 01, 2023 6: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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: FWH2310: WhatsApp messages with Attachments/Images

Postby Silvio.Falconi » Wed Nov 01, 2023 5: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 67 guests