Noi avem scriptul asta:
procedure fawap
Parameters WAPTEL,WAPMESS,WAPFILE
pdf_filepath = Alltrim(WAPFILE)
WAPTEL=Alltrim(WAPTEL)
WAPMESS=Alltrim(WAPMESS)
ccMessage='. '
_Cliptext = ''
Do wafoxpdf With pdf_filepath
***
Function wafoxpdf
Parameters CFilepath
_Cliptext = CFilepath && Path For PDF
Declare Sleep In kernel32 Integer
Declare Integer FindWindow In WIN32API String , String
Declare Integer SetForegroundWindow In WIN32API Integer
Declare Integer ShowWindow In WIN32API Integer , Integer
Declare Integer ShellExecute In shell32.Dll Integer hndWin, String cAction, String cFileName, String cParams, String cDir, Integer nShowWin
Wait Window '' Timeout 2
Local lt, lhwnd
lt = "Whatsapp"
lhwnd = FindWindow (0, lt)
If lhwnd!= 0
**ESTE DESCHIS WHATSAPP
cPhone=[&waptel]
cmd='whatsapp://send?phone=&cPhone&text='+ccMessage
=ShellExecute(0, 'open', cmd,'', '', 1)
Wait Window "Asteptati...deschid Whatsapp.." Timeout 3
SetForegroundWindow (lhwnd)
ShowWindow (lhwnd, 1)
**1-normal, 2-minimized, 3-maximized
ox = Createobject ( "Wscript.Shell" )
SetForegroundWindow (lhwnd)
**ADAUG 2 BACKTABURI
If XBTAB2>0
For nn=1 To XBTAB2
ox.sendkeys ("+{TAB}")
=Inkey(.5)
Endfor
Endif
**ia text
If !Empty(WAPMESS)
_Cliptext = WAPMESS
=Inkey(.5)
ox.sendkeys ("^{v}")
=Inkey(.5)
Endif
**ia pdf
If !Empty(CFilepath) And File(CFilepath)
_Cliptext = CFilepath
For mm=1 To Len(xtabpdf)
cetab=Substr(xtabpdf,mm,1)
Do Case
Case cetab='T'
ox.sendkeys ("+{TAB}")
=Inkey(.5)
Case cetab='E'
ox.sendkeys ("{ENTER}")
=Inkey(.5)
Case cetab='V'
ox.sendkeys ("^{v}")
=Inkey(.5)
Endcase
Endfor
Endif
**trimite
=Inkey(.5)
ox.sendkeys ("{ENTER}")
=Inkey(1)
Else
*NU ESTE DESCHIS WHATSAPP
cPhone=[&waptel]
cmd='whatsapp://send?phone=&cPhone&text='+ccMessage
=ShellExecute(0, 'open', cmd,'', '', 1)
Wait Window "Asteptati...deschid Whatsapp.." Timeout xtempo4
_Cliptext = CFilepath
lhwnd = FindWindow (0, lt)
If lhwnd!= 0
SetForegroundWindow (lhwnd)
ShowWindow (lhwnd, 1)
**1-normal, 2-minimized, 3-maximized
ox = Createobject ( "Wscript.Shell" )
SetForegroundWindow (lhwnd)
=Inkey(.5)
*CANCEL
**ADAUG 2 BACKTABURI
For nn=1 To xbtab1
ox.sendkeys ("+{TAB}")
=Inkey(.5)
Endfor
**ia text
If !Empty(WAPMESS)
_Cliptext = WAPMESS
ox.sendkeys ("^{v}")
=Inkey(.5)
Endif
**ia pdf
If !Empty(CFilepath) And File(CFilepath)
_Cliptext = CFilepath
For mm=1 To Len(xtabpdf)
cetab=Substr(xtabpdf,mm,1)
Do Case
Case cetab='T'
ox.sendkeys ("+{TAB}")
=Inkey(.5)
Case cetab='E'
ox.sendkeys ("{ENTER}")
=Inkey(.5)
Case cetab='V'
ox.sendkeys ("^{v}")
=Inkey(.5)
Endcase
Endfor
Endif
**trimite
=Inkey(.5)
ox.sendkeys ("{ENTER}")
=Inkey(1)
Else
Messagebox ("Eroare deschidere Whatsapp...")
reusit=.F.
Endif
Endif
dar as vrea sa gasim ceva mai stabil