#include "FiveWin.ch"
FUNCTION Main()
LOCAL oDlg1, oBrw, oBot1,;
aCols := {;
{'54999999999','*Jose:*'+chr(13)+'Venezuela','https://forums.fivetechsupport.com/download/file.php?avatar=3176_1605719869.jpg',"c:\fwh21\samples\whatsapp.prg"},;
{'54999999999','*Mr. Rao:*'+chr(13)+'India','https://forums.fivetechsupport.com/download/file.php?avatar=868_1446686491.jpg',"c:\fwh21\samples\whatsapp1.prg"},;
{'54999999999','*Cesar:*'+chr(13)+'Argentina','https://forums.fivetechsupport.com/download/file.php?avatar=294_1327638239.jpg',"c:\fwh21\samples\whatsapp2.prg"}}
DEFINE DIALOG oDlg1 TITLE "Envio de whatsapp" SIZE 700,600 PIXEL TRUEPIXEL RESIZABLE
@ 60, 20 XBROWSE oBrw SIZE 600,500 pixel OF oDlg1 ARRAY aCols ;
HEADERS "Telefono", "Texto","Imagen","Adjunto";
COLUMNS 1,2,3,4;
SIZES nil, 100,150,nil;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 150
:aCols[3]:cDataType := "P"
:CreateFromCode()
END
@ 05,05 BUTTON oBot1 PROMPT "&Enviar" OF oDlg1 SIZE 100,40 ACTION Enviar(aCols,oBrw) PIXEL
ACTIVATE DIALOG oDlg1 CENTERED
RETURN nil
*--------------------------------------------------------------------------------
STATIC Function Enviar(aData, oBrw)
Local oShell, cTexto, i
oBrw:GoTop()
FOR i := 1 TO LEN(aData)
cTexto := aData[i,2]
XbrCopyColumnImage(oBrw:aCols[3])
cTexto := STRTRAN(cTexto," ","%20")
cTexto := STRTRAN(cTexto,"&","%26")
cTexto := STRTRAN(cTexto,chr(13),"%0D%0A")
ShellExecute( 0, "open", "whatsapp://send?phone="+alltrim(aData[i,1])+"&text="+cTexto)
oShell := CreateObject( "WScript.Shell" )
syswait(.2)
oShell:SendKeys( "~" )
syswait(3)
oShell:SendKeys( "^v" )
syswait(4)
oShell:SendKeys("~")
syswait(4)
oShell:SendKeys("+{TAB}")
syswait(.2)
oShell:SendKeys("~")
syswait(.2)
oShell:SendKeys("{DOWN}")
syswait(.2)
oShell:SendKeys("~")
syswait(2)
oShell:SendKeys(aData[i,4])
syswait(.2)
oShell:SendKeys("~")
syswait(4)
oShell:SendKeys("~")
syswait(.2)
oShell:SendKeys("{TAB}")
oBrw:Skip()
NEXT i
Return nil
function XbrCopyColumnImage( oCol )
local aBmp
local lRet := .f.
if IfNil( oCol:cDataType, " " ) $ "PF"
aBmp := FW_ReadImage( nil, oCol:Value, nil, .f. )
if !Empty( aBmp[ 1 ] )
GDIPLUSHBITMAPTOCLIPBOARD( aBmp[ 1 ], GetDeskTopWindow() )
lRet := .t.
PalBmpFree( aBmp )
endif
endif
return lRet