enviar mensajes a whatsapp, ¿posible solucion?

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby cmsoft » Fri Oct 27, 2023 4:10 pm

nageswaragunupudi wrote:I am asking your help to finalize this.

No me esta funcionando el envio de adjuntos.
Sera porque tengo la version desactualizada?
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby cmsoft » Fri Oct 27, 2023 4:38 pm

JoseAlvarez wrote:WhatsApp podria banear la cuenta desde la cual se realizan los envíos, si el uso es continuo, de mucho volumen de mensajes o la cantidad de destinatarios sea grande, en cada ciclo de mensajes emitidos. Tal es el caso de mi aplicacion.

Por la experiencia que yo he podido recabar del tema de envíos masivos, el problema principal es que los número de teléfono no estén agendados en el propietario que envía esos mensajes, y también depende que los receptores de dichos mensajes, denuncien como span dicho mensaje.
De lo contrario, no hemos tenido problemas con bloqueos por parte de Whatsapp
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby Giovany Vecchi » Fri Oct 27, 2023 7:28 pm

Hola gente.
Utilizo una alternativa con la aplicación file2clip.exe que copia cualquier tipo de archivo al clipboard de Windows.
El proyecto está aquí: https://github.com/rostok/file2clip

Y a continuación se muestra la función:
Code: Select all  Expand view
FUNCTION WHATS_APP_GO_DIRECT(f_cPhoneNumber,f_cMessage,f_cFileSend,f_cCountryCode)
   Local lc_cCommandStart     := ""
   Local lc_cCommandTxt       := ""
   Local lc_cCommandFile      := ""
   Local lc_oClipBoard
   Local lc_hWndWhats
   Local lc_oShellScr
   Local lc_oShellFolder    
   Local lc_iFor           := 0

   Default f_cMessage := "", f_cFileSend := "", f_cCountryCode := "55"
   
    lc_cCommandStart  := "whatsapp://send?phone=_cPhoneNumber_"
   lc_cCommandTxt    := "whatsapp://send?phone=_cPhoneNumber_&text=_cMessage_"
   lc_cCommandFile   := Hb_DirBase()+"file2clip.exe _cFileSend_"
   
   f_cPhoneNumber    := StrTran(f_cPhoneNumber," ","")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,"(","")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,")","")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,",","")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,"-","")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,".","")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,"+"+f_cCountryCode,"")
   f_cPhoneNumber    := StrTran(f_cPhoneNumber,"+","")
   f_cPhoneNumber    := f_cCountryCode+f_cPhoneNumber
   
   f_cMessage        := StrTran(f_cMessage,CRLF,"%0A")
   f_cMessage        := StrTran(f_cMessage," ","%20")
   f_cMessage        := StrTran(f_cMessage,"&","%26")
   f_cMessage        := StrTran(f_cMessage,chr(13),"%0D%0A")

   If !Empty(f_cFileSend)
      f_cFileSend    := Lfn2Sfn(f_cFileSend)
      f_cFileSend    := chr(34)+f_cFileSend+chr(34)
   EndIf

   lc_cCommandStart  := StrTran(lc_cCommandStart,"_cPhoneNumber_",f_cPhoneNumber)

   lc_cCommandTxt    := StrTran(lc_cCommandTxt,"_cPhoneNumber_",f_cPhoneNumber)
   lc_cCommandTxt    := StrTran(lc_cCommandTxt,"_cMessage_",f_cMessage)

   lc_cCommandFile   := StrTran(lc_cCommandFile,"_cFileSend_",f_cFileSend)

   ShellExecute(0,"open",lc_cCommandStart)
   syswait(2)
   
   lc_hWndWhats := FindWindow(,"WhatsApp")

   if hb_IsNil(lc_hWndWhats)
      MsgStop("WhatsApp não esta carregado.","Procedimento abortado.")
      Return .F.
   Else
      if lc_hWndWhats == 0
         MsgStop("WhatsApp não esta carregado.","Procedimento abortado.")
         Return .F.

      Else
         BringWindowToTop( lc_hWndWhats )
         SysWait(.3)
      EndIf
   EndIf  

   //? lc_cCommandTxt
   
   lc_oShellScr         := tOleAuto():New( "WScript.Shell" )
   
   If !Empty(f_cMessage)
      ShellExecute(0,"open",lc_cCommandTxt)
      syswait(.5)
      lc_oShellScr:SendKeys( "~" )
   EndIf

   //? lc_cCommandFile

   If !Empty(f_cFileSend)
      WaitRun(lc_cCommandFile,0)
      syswait(.4)
      lc_oShellScr:SendKeys( "^v" )
      syswait(1)      
      lc_oShellScr:SendKeys( "~" )
      syswait(.5)      
   EndIf


RETURN NIL
 
User avatar
Giovany Vecchi
 
Posts: 207
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby sysctrl2 » Fri Oct 27, 2023 7:53 pm

Estaría super unos Wrapers para API Green, :lol:
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 951
Joined: Mon Feb 05, 2007 7:15 pm

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby cmsoft » Fri Oct 27, 2023 11:12 pm

Esta es la funcion Fw_CopyToClipboar que tengo en mi versión, creo que no esta considerando array de archivos.
Code: Select all  Expand view

function FW_CopyToClipBoard( uValue, nFormat )

   local lCopied  := .f.

   if HB_ISPOINTER( uValue ) // assumes GDI+ Image object
      GDIPLUSImageToClipBoard( uValue )
      return .t.
   endif

   if uValue != nil
      DEFAULT nFormat := If( HB_ISSTRING( uValue ), 1, ;
                         If( HB_ISNUMERIC( uValue ) .and. ISHBITMAP( uValue ), ;
                         2, nil ) )
      if nFormat != nil
         if OpenClipBoard( GetDeskTopWindow() )
            EmptyClipboard()
            lCopied  := SetClipboardData( nFormat, uValue )
            CloseClipboard()
         endif
      endif
   endif

return lCopied
 
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby nageswaragunupudi » Sat Oct 28, 2023 1:35 am

What is your FWH version?
Regards

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

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby nageswaragunupudi » Sat Oct 28, 2023 1:42 am

You can also try WhatsApp business
https://business.whatsapp.com/
Regards

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

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby nageswaragunupudi » Sat Oct 28, 2023 1:54 am

Esta es la funcion Fw_CopyToClipboar que tengo en mi versión, creo que no esta considerando array de archivos.

Possible from FWH2307 onwards only.
This is because the C level improvements for CF_HDROP were implemented in FWH2307 only that are necessary for copy multiple files to clipboard. (fwh\source\winapi\clpbrd.c)

We will test and include the above function as a sample in FWH2310.

At the same time, we will work on a function that will work with all older versions also now.
Regards

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

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby nageswaragunupudi » Sat Oct 28, 2023 2:42 pm

cmsoft wrote:Jose:
Esta es una manera de enviar mensajes con documentos adjuntos.
Lo que debes hacer es emular el uso de teclado en la aplicación de Whatsapp
Code: Select all  Expand view

#include "FiveWin.ch"
function Main()
local oShell                                                        
   ShellExecute( 0, "open", "whatsapp://send?phone=111111111111&text=Estimado Sr. Antonio Linares.%0A"+;
    "Gusto en Saludarle, "+ Time() )
   oShell := CreateObject( "WScript.Shell" )
   syswait(.2)
   oShell:SendKeys( "~" ) //Doy enter para que envie el mensaje
   syswait(2)
   oShell:SendKeys("+{TAB}") //Presiono Shift Tab para que vaya a adjuntar
   syswait(.2)
   oShell:SendKeys("~") //Doy enter
   syswait(.2)
   oShell:SendKeys("{DOWN}") // Presiono flecha abajo
   syswait(.2)
   oShell:SendKeys("~")  // Doy enter
   syswait(2)
   oShell:SendKeys("c:\fwh21\samples\prueba.pdf") // Escribo el nombre del documento adjunto
   syswait(.2)
   oShell:SendKeys("~") // Doy enter
   syswait(4)
   oShell:SendKeys("~") // Doy enter
   syswait(.2)
   oShell:SendKeys("{TAB}") // Presiono TAB para que vuelva a la casilla de escritura de mensajes
return nil
 


Si falla, puedes cambiar los tiempos de espera entre cada acción, solo es cuestion de ir probando.
Espero que te sirva


For versions prior to 2307, this approach is very nice.

For sending Image Files like jpg,bmp,png,etc.
skip these three lines
[code]   oShell:SendKeys("{DOWN}") // Presiono flecha abajo
   syswait(.2)
 /code]
Regards

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

Re: enviar mensajes a whatsapp, ¿posible solucion?

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

Regards

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

Re: enviar mensajes a whatsapp, ¿posible solucion?

Postby cmsoft » Sun Oct 29, 2023 1:11 pm

Muchas gracias Mr. Rao.
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests