Bom dia Theotokos
Deu certo
na verdade em vez de fechar o programa ele fecha a conexao do usuario que esta aberto e abre a tela para logar de novo
ou seja usei a sua ideia
Obrigado
Amiguinhos,
Eu não tinha ciencia desta plataforma para este fim, afinal o que não falta são estas plataformas por ai, mas se o seu cliente adquiriu creio que foi pelo preço que está muito bom em relação à outras.
No que tange a integração eu creio que você precisará inicialmente fazer 4 interações iniciais sendo: Inclusão de Categoria, Exclusão de Categoria, Inclusão de Produtos e Exclusão de produtos.
Veja na API se a mesma possui exemplo via CURL(que serão comandos a base de prompt) e comece a fazer os envios de comandos.
Vendo que eles funcionam faça com que seu sistema gere o teto do comando e acione o CURL.
Quando se sentir seguro integre usando as chamadas à API.
Bom trabalho.
Desculpe a brincadeira mas olhando esses código me lembrei da minha vida antes de conhecer o FastReport, acertar e ajeitar isso era terrível, um castigo que nenhum programador merece kkkk
Boa tarde, andei dando uma olhada nas dicas postadas aqui no fórum e consegui gerar o QRCODE PIX
Só não testei com chave email.
Segue para quem quiser baixar e modificar
https://mega.nz/file/hkUXkKAI#6e4rNTcr-bA9lYvRThy8clH7_N7NWC9imvmkVWBS7y4
Obrigado Jovem !
Esta opção oculta o objeto, havia feito e não em lembrava, segue abaixo:
-Só funciona para classe tget:
oGet:lDisColors := .F. //é show tget- mudar cor get when=f
oGet:nClrTextDis := CLR_HBLUE //é show tget - mudar cor get when=f
Na classe TMultiGet não consegui com when = .f., dá para usar readonly sem when = .f., desta forma é possível ajustar a cor
Resolvido !
#include "inkey.ch"
#include "icbrasil.ch"
Function Main()
public p_aListObjects := {}, p_nNormalMaxrow := 33, p_nNormalMaxcol := 98
REQUEST DBFCDX
RDDSETDEFAULT("dbfcdx")
DBSETDRIVER("dbfcdx")
wvw_settitle( 0, "...#### JAF DESENVOLVIMENTO - ENVIO DE MENSAGEM ZAP VIA MEGA ( By Frazato )####..." )
Parameters xExecutarRotina
If xExecutarRotina==nIL
xExecutarRotina := 'SEM PARAMETROS'
Endif
Iniciar()
COR_NORMAL
Close all
nLista := Directory("c:\temp\Zap\*.jpeg","D")
If Len(nLista)<=0
ALERTA('E NECESSARIO COLOCAR OS ARQUIVO *.JPEG NA PASTA C:\TEMP\ZAP')
Endif
If Len(nLista)>10
ALERTA('CARO AMIGO ACHO EU QUE TEM MUITO ARQUIVO PARA ENVIO, USUARIO NAO GOSTA VERIFIQUE A PASTA C:\TEMP\ZAP')
Endif
If xExecutarRotina=='ROBO'
RoboZap()
return nil
Endif
Sele 1
use MSGZAP alias contato //Exclusive
If ! File('msgzap.cdx')
index on Nome tag nomes to msgzap
index on telefone tag fones to msgzap
endif
Set index to msgzap
Sele Contato
OrdSetFocus('nomes')
Go top
nReg_ok:= nReg_Nt:= nReg_ := 0
Do while ! EOF()
If Contato->TemZap=='OK'
nReg_ok++
ElseIf Contato->TemZap=='NT'
nReg_Nt++
Else
nReg_++
Endif
Skip+1
Enddo
cStatus_banco := Space(3)+;
"("+Alltrim(Str(nReg_ok,5))+' OK )'+Space(3)+;
"("+Alltrim(Str(nReg_nt,5))+' NT )'+Space(3)+;
"("+Alltrim(Str(nReg_ ,5))+' NA )'
Go Top
@ 00,00 say padc('JAF ENVIO DE WHASPP VIA APP MEGA',MaxCol()) color('nn+/WW+')
@ 01,00 say padc('--------------------------------'+xExecutarRotina,MaxCol())
@ 02,00 say padc('INS-NOVO ENTER-ALTERA DEL-EXCLUI SPACE-MARCA/DESMARCA ==> F10-MENU OPCAO',MaxCol())
@ 03,00 say padc('F3-PESQUISA NOME F9-VERIFICA CONTATO ==>'+cStatus_banco,MaxCol())
@ 04,00 TO 04,MaxCol()
oTab:=TbrowseDb(05,00,MaxRow()-2,MaxCol())
oTab:ColSep := " ³ "
oTab:HeadSep := "___"
oTab:ColorSpec := "n/ww+*,B/GR+*,N/w,N/W*+,g+*/ww+*"
Coluna1 := TbColumnNew("Telefone ",{ ||Substr(Contato->Telefone,1,12)+' '+Substr(Contato->Nome,1,30)+' '+Contato->Temzap } )
Coluna2 := TbColumnNew("Envio ",{ ||Substr(Contato->DataEnv,1,20)} )
Coluna3 := TbColumnNew("Mensagem ",{ ||Substr(Contato->Msg,1,40) } )
Coluna4 := TbColumnNew("Pedido ",{ ||Contato->DataPed } )
Coluna5 := TbColumnNew("Arquivo ",{ ||Contato->Arquivo } )
Coluna6 := TbColumnNew("Retorno APP",{ ||Contato->Retorno } )
oTab:AddColumn(Coluna1)
oTab:AddColumn(Coluna2)
oTab:AddColumn(Coluna3)
oTab:AddColumn(Coluna4)
oTab:AddColumn(Coluna5)
oTab:AddColumn(Coluna6)
Do While .t.
For i:= 1 to 6// 6
oTab:GetColumn(i):ColorBlock := { || { Iif(OrdKeyNo()%2==0,4,3),2 } }
Next
Do While ! oTab:Stabilize()
Enddo
nKey := Inkey()
If oTab:Stable
nKey := Inkey(0)
oTab:ForcEstable()
Endif
If nKey == K_ESC
Exit
ElseIf nKey == K_ENTER
Manutencao(.f.)
oTab:Refreshall()
ElseIf nKey == K_DEL
If op:= Alert('CONFIRMA EXCLUSAO DO CONTATO '+Alltrim(Contato->Telefone),{'SIM','NAO'})==1
Trav_reg()
Delete
Skip+1
If Bof()
Go top
Endif
oTab:Refreshall()
Endif
ElseIf nKey == K_INS
Manutencao(.t.)
oTab:Refreshall()
ElseIf nKey == K_F10
ROTINAS()
ElseIf nKey == K_F9
If Zap_VerStatus()==.t.
Zap_checaContato(Contato->Telefone)
Endif
ElseIf nKey == K_SPACE
If Empty(Contato->DataEnv)
IF MSGCONF("Confirma DESMARCACAO ?"+Alltrim(Contato->Nome),"1") == .t.
Trav_reg()
Repla Contato->DataEnv With DTOC(DATE())
Repla Contato->MSg With ''
Repla Contato->Arquivo With ''
Endif
Else
IF MSGCONF("Confirma MARCAO ?"+Alltrim(Contato->Nome),"1") == .t.
Trav_reg()
Repla Contato->DataEnv With ''
Repla Contato->MSg With 'La Villa, Ofertas!'
Repla Contato->Arquivo With 'PASTA'
Endif
Endif
oTab:Refreshall()
ElseIf nKey == K_F3 // PESQUISA NOME
PESQNOME()
oTab:Refreshall()
ElseIf nKey == K_UP
oTab:Up()
ElseIf nKey == K_DOWN
oTab:Down()
ElseIf nKey == K_LEFT
oTab:Left()
ElseIf nKey == K_RIGHT
oTab:Right()
ElseIf nKey == K_PGUP
oTab:PAGEUP()
ElseIf nKey == K_PGDN
oTab:PAGEDOWN()
ElseIf nKey == K_CTRL_PGUP
oTab:goTop()
oTab:Refreshall()
ElseIf nKey== K_CTRL_PGDN
oTab:goBottom()
oTab:Refreshall()
Endif
Enddo
Close all
return nil
******************
FUNCTION Iniciar()
******************
local lRet := .T.
dbsetdriver("DBFCDX")
set confirm on
set deleted on
set bell off
set scoreboard off
set eventmask to INKEY_ALL
set date british
set epoch to 1950
set exclusive off
Set date format to "DD/MM/YYYY"
SET WRAP ON
lRet := WVW_SetFont(,'Ms Sans Serif', 24, 11 ) // IDEAL E PADRAO
If GetEnv("WINDOWS98")=='S'
lRet := WVW_SetFont(,cTipoFonte)
Endif
If !lRet
wvw_messagebox(0, "Fonte não carregada", "JAF Desenv.", 0)
lRet := WVW_SetFont(,'Ms Sans Serif', 16, 8 ) // LABORATORIO
Endif
wvw_noclose()
wvw_seticon(, "cxwin.ico" )
wvw_size_ready(.T.)
wvw_setmaincoord(.T.)
wvw_SetPaintRefresh(0)
WVW_SetCodePage(,255) // 250
wvw_SetVertCaret(.F.)
wvw_enableshortcuts(0,.T.)
* SetInkeyAfterBlock({|nkey| AfterInkey( nkey ) })
wvw_maximize(0)
COR_NORMAL
Jta(0)
* Toolbar(0)
* Jta(0)
cls
lRet := .t.
RETURN lRet
//-------------------------------------------------------
Function Trav_Reg()
Local Tela01 := Savescreen(00,00,24,79)
Local nTenta := 0
Local nHora1 := Time()
Local CorOld := SetColor()
Do While (!Rlock())
nTenta++
Centra(24,'Gravando dados no Banco de Dados...'+str(nTenta))
If nTenta >= 150
SetColor("W+*/R")
@ 10,10 Clear to 15,60
@ 10,10 to 15,60 Double
SetColor("GR+/R")
@ 11,11 say padc("Registro Alocado",48)
@ 13,11 say "Tentativa n§:"
@ 14,11 say " Tempo Gasto:"
@ 13,26 say Str(nTenta,10) Color("WW+*/R")
@ 14,26 say Elaptime(nHora1,Time())
Endif
Enddo
Setcolor(CorOld)
Centra(24,'')
*RestScreen(00,00,24,79,Tela01)
Return nil
Function Destrava()
DbUnlock()
//Commit
Return nil
***********************************************************
FUNCTION WVW_SIZE( nWindow, hWnd, message, wParam, lParam )
***********************************************************
local cScreen, maxsavedscrrow, maxsavedscrcol, lNeedReset := .f.
if !WVW_SIZE_READY()
return NIL
endif
if nWindow # 0
return NIL
endif
WVW_SIZE_READY(.F.)
do case
case wParam == 2 // Maximizar a janela
if ( maxcol() # wvw_maxmaxcol() .or. maxrow() # wvw_maxmaxrow() )
maxsavedscrrow := min( min( p_nNormalMaxrow, wvw_maxmaxrow() ), maxrow() )
maxsavedscrcol := min( min( p_nNormalMaxcol, wvw_maxmaxcol() ), maxcol() )
cScreen := savescreen( 0, 0, maxsavedscrrow, maxsavedscrcol )
if setmode( wvw_maxmaxrow()+1, wvw_maxmaxcol()+1 )
restscreen( 0, 0, maxsavedscrrow, maxsavedscrcol, cScreen )
endif
endif
case wParam == 0 // Restaurar o Tamanho da Janela
if ( maxcol() # p_nNormalMaxcol .or. maxrow() # p_nNormalMaxrow )
maxsavedscrrow := min( p_nNormalMaxrow, maxrow() )
maxsavedscrcol := min( p_nNormalMaxcol, maxcol() )
cScreen := savescreen( 0, 0, maxsavedscrrow, maxsavedscrcol )
if setmode( p_nNormalMaxrow+1, p_nNormalMaxcol+1 )
restscreen( 0, 0, maxsavedscrrow, maxsavedscrcol, cScreen )
endif
endif
otherwise
endcase
WVW_SIZE_READY(.T.)
RETURN NIL
//
// FUNCAO : WVW_Timer()
// PARAMETROS : nWindow - N§ da janela
// hWnd -
// message -
// wParam -
// lParam -
// DESCRICAO : Funcao chamada ao intervalo definido na funcao WVW_SETTIMER()
// RETORNO :
//
************************************************************
FUNCTION WVW_TIMER( nWindow, hWnd, message, wParam, lParam )
************************************************************
WVW_SBSetText(, 2, time() )
RETURN NIL
**********************************
STATIC FUNCTION jta(nWindow)
local hWndSB := ""
wvw_sbdestroy(nWindow)
IF ! Empty( wvw_sbCreate() ) .AND. wvw_sbAddPart( , "99:99:99" ) > 0
wvw_SetTimer( , 1000 )
ENDIF
*if WVW_SBAddPart(, "99/99/9999" ) > 0
*set century on
WVW_SBSetText(nWindow, 1,'CORTEZIA - JAF DESENVOLVIMENTO' )
*WVW_SBSetText(nWindow, 2, time() )
*set century off
*endif
//--------------------------------------------------------------
static Function Manutencao(lOp)
Local cTelefone := Space(12)
Local CCONTATO := Space(40)
Local GetList := {}
Local Tela := Savescreen(00,00,24,79)
Local CorOld := SetColor()
If lOp == .f. // Alteracao
cTelefone := Contato->Telefone
cContato := Contato->Nome
Endif
setcolor('g/r')
@ 11,10 say PADC(Iif(lop==.t.,'NOVO CONTATO','ALTERANDO '+cTelefone),61) COLOR 'GR+/N'
@ 12,10 Clear to 15,70
@ 13,11 say 'TELEFONE....' GET CTELEFONE Pict '999999999999'
Read
If LastKey()#27
Go top
OrdsetFocus('Fones')
Seek StrZero(val(cTelefone),11)
if Found()
Alerta('Telefone ja cadastrado '+ Contato->Nome)
cContato := Contato->Nome
lop := .f.
Endif
Endif
@ 14,11 SAY 'CONTATO.....' GET CCONTATO Pict "@!"
Read
If LastKey()#27
If Conf := Alert('Confirma INCLUSAO/ALTERACAO',{'Sim','Nao'})== 1
If lop==.t.
Append Blank
Repla Contato->Telefone With cTelefone
Endif
Trav_reg()
Repla Contato->Nome With cContato
Endif
Endif
SetColor(CorOld)
RestScreen(00,00,24,79,Tela)
Return nil
//----------------------------------------------------------
Function EnviarMsgTexto(cNumero,cMsg,cPDF,lteste,lEnviaJPG)
Local i
*Local Url :='http://api2.megaapi.com.br:10248/'// sendfilebase64?'
*Local cToken := "demo12345678910"
Local Url :='http://api2.megaapi.com.br:15358/'// sendfilebase64?'
Local cToken := "M_CI33zodtF1UisZAD"
Local cRetorno :=''
Local mTemporal_:= 'c:\temp\'
If lEnviaJPG==.t.
mTemporal_:= 'c:\temp\zap\'
Endif
If cMsg==''
*Alerta('sem msg!!')
Return .f.
Endif
if lteste # Nil
hHash := Hash()
Endif
*Alert("Erro ao chamar metodo SEND de HttpRequest (Registro envio)"+chr(10)+cErrorTmp )
lErroEnvio := .t.
End
If lErroEnvio == .t.
Centra(24,cErrorTmp)
Return .f. // cErrorTmp
Endif
DO WHILE xmldoc:readyState <> 4
MILLISEC(1000)
ENDDO
Linha :=xmldoc:responseText
Linha2:=xmldoc:ResponseBody()
IF VALTYPE(hHash) != 'H'
*Alert( 'Algo deu errado, verifique Endereço/token da API')
RETURN(.F.)
ENDIF
IF len(hHash)<0
*Alert('Algo deu errado, verifique Endereço/token da API ou retorno vazio, tente novamente')
RETURN(.F.)
ENDIF
RETURN .t.
//------------------------------------------------
Static Function RoboZap()
Local nQtdMSgEnviar:= 0
Local nQtdMsgEnviadas:= 0
Local TestaStatus := .t.
Close all
Sele 1
Use MSGZAP Alias Lista
set index to MsgZap
Sele Lista
OrdSetFocus('nomes')
Go top
Do while ! Eof()
If Empty(Lista->DATAENV) .and. Lista->Temzap=='OK'
nQtdMSgEnviar++
Endif
Skip+1
enddo
Go top
lTestaStatus := .t. // teste somente quando der problema
Do while .t.
hHash := Hash()
If Lista->Temzap#"OK" // pula problemas
Skip+1;Loop
Endif
If Empty(Lista->DATAENV) // .AND. !Empty(Lista->TELEFONE)
If lTestaStatus==.t.
lOkStatus := Zap_VerStatus()
Endif
* If Zap_VerStatus()==.t.
If lOkStatus == .t.
lTestaStatus := .f.
*Alert("Erro ao chamar metodo SEND de HttpRequest (Registro envio)"+chr(10)+cErrorTmp )
lErroEnvio := .t.
End
If lErroEnvio == .t.
Return .f. // cErrorTmp
Endif
DO WHILE xmldoc:readyState <> 4
MILLISEC(1000)
ENDDO
Linha :=xmldoc:responseText
Linha2:=xmldoc:ResponseBody()
MemoWrit(mTemporal+'revisao2.txt',Linha2)
MemoWrit(mTemporal+'revisao1.txt',Linha )
hHash2 := Hash()
hb_jsondecode( Linha,@hHash2 )
IF VALTYPE(hHash2) != 'H'
*Alert( 'Algo deu errado, verifique Endereço/token da API')
RETURN(.F.)
ENDIF
IF len(hHash2)<0
*Alert('Algo deu errado, verifique Endereço/token da API ou retorno vazio, tente novamente')
RETURN(.F.)
ENDIF
IF HHasKey( hHash2, 'accountStatus' ) // True
If hHash2['accountStatus'] // True
if HHasKey( hHash2, 'state' )
If hHash2['state']=='connected'
Return .t. // Concentaro
Endif
Endif
Endif
ENDIF
RETURN .f.
//---------------------------------------------------------------------------
Static Function ZAP_PegaQrCodi()
Local i
*Local Url :='http://api2.megaapi.com.br:10248/qrcode?'
*Local cToken := "demo12345678910"
Local Url :='http://api2.megaapi.com.br:15358/qrcode?'// sendfilebase64?'
Local cToken := "M_CI33zodtF1UisZAD"
Local cRetorno :=''
Local mTemporal:= 'c:\temp\'
IF MSGCONF("Confirma a Obtencao QrCodi,Faca logout antes! ","1") == .f.
Return nil
Endif
* Alert("Erro ao chamar metodo SEND de HttpRequest (Registro envio)"+chr(10)+cErrorTmp )
lErroEnvio := .t.
End
If lErroEnvio == .t.
Return cErrorTmp
Endif
DO WHILE xmldoc:readyState <> 4
MILLISEC(1000)
ENDDO
Linha :=xmldoc:responseText
Linha2:=xmldoc:ResponseBody()
MemoWrit(mTemporal+'revisao2.txt',Linha2)
MemoWrit(mTemporal+'revisao1.txt',Linha )
nInicio := ["qrCode":"data:image/png;base64,]
nPos := At(nInicio,Linha)
cDados := Substr(Linha,nPos+Len(nInicio),30000)
cDados := StrTran(cDados,["}],'')
MemoWrit(mTemporal+'revisao1.txt',cDados,.f. )
cDados = hb_base64Decode(cDados)
MemoWrit(mTemporal+'QrCodi.jpg',cDados,.f.)
! (mTemporal+'QrCodi.jpg')
RETURN .t.
//------------------------------------------------------------------------------------
Function ZAP_Logout()
Local i
*Local Url :='http://api2.megaapi.com.br:10248/logout?' ///logout
*Local cToken := "demo12345678910"
Local Url :='http://api2.megaapi.com.br:15358/logout?'// sendfilebase64?'
Local cToken := "M_CI33zodtF1UisZAD"
Local cRetorno :=''
Local mTemporal:= 'c:\temp\'
IF MSGCONF("Tem certeza que deseja fazer o Logout do WhastApp(Mega)","1") == .f.
Return nil
Endif
* Alert("Erro ao chamar metodo SEND de HttpRequest (Registro envio)"+chr(10)+cErrorTmp )
lErroEnvio := .t.
End
If lErroEnvio == .t.
Return cErrorTmp
Endif
DO WHILE xmldoc:readyState <> 4
MILLISEC(1000)
ENDDO
Linha :=xmldoc:responseText
Linha2:=xmldoc:ResponseBody()
*MemoWrit(mTemporal+'revisao2.txt',Linha2)
*MemoWrit(mTemporal+'revisao1.txt',Linha )
hHash2 := Hash()
hb_jsondecode( Linha2, @hHash )
IF VALTYPE(hHash2) != 'H'
// Alert( 'Algo deu errado, verifique Endereço/token da API')
RETURN(.F.)
ENDIF
IF len(hHash2)<0
// Alert('Algo deu errado, verifique Endereço/token da API ou retorno vazio, tente novamente')
RETURN(.F.)
ENDIF
IF HHasKey( hHash2, 'state' )
If ALLTRIM(hHash2['state']) # 'connected'
Return .f.
Endif
ENDIF
RETURN .t.
//------------------------------------------------------------------------
STATIC Function ROTINAS()
LOCAL OP := 1, TELA01 := SAVESCREEN(00,00,MaxRow(),MaxCol())
Local opcao := 7
Local cZapStatus:= 'OFFLINE-VERIFIQUE CELULAR'
do while .t.
OPCAO := 10
If Zap_VerStatus()==.t.
cZapStatus:= 'ONLINE-PRONTO PARA USO'
Endif
*AADD( OPCAO,{ "Verificar STATUS Coneccao WhatsApp(Mega) "+cZapStatus,"080" ,{ || Alerta(iif(Zap_VerStatus()==.t.,'Ok-Operando','Offline')) ,'Zap_VerStatus()' } } )
*AADD( OPCAO,{ "Logout Servico Whastapp MEGA "+Space(Len(cZapStatus)),"080" ,{ || ZAP_Logout() ,'ZAP_Logout()' } } )
*AADD( OPCAO,{ "Pegar QRCodi "+Space(Len(cZapStatus)),"080" ,{ || ZAP_PegaQrCodi() ,'ZAP_PegaQrCodi()' } } )
*AADD( OPCAO,{ "Enviar uma Mensagem Teste para o JAF "+Space(Len(cZapStatus)),"080" ,{ || EnviarMsgTexto("14997140865",'JAF, mensagem de teste!','',.t.),[EnviarMsgTexto("14996114611",'JAF, mensagem de teste!','',.t.)] } } )
*AADD( OPCAO,{ "Enviar Mensagem AVulso "+Space(Len(cZapStatus)),"080" ,{ || Zap_avulso(),''} } )
*AADD( OPCAO,{ "Robo de envio de ZAP ( MSGZAP.DBF) "+Space(Len(cZapStatus)),"080" ,{ || RoboZap(),''} } )
*Setcolor('NN*/RB+,Y/GR')
setcolor("W/BR+,n+/gr+*,n,n,n/w*")
@ 03,05 clear to 23,65
@ 02,04 to 24,66 DOUBLE
@ 02,05 say padc('R O T I N A S / F U N C O E S ',61) Color('w/G')
@ 03,11 say cZapStatus
@ 05,11 prompt '1-Verificar STATUS Coneccao WhatsApp(Mega)'
@ 07,11 PROMPT '2-Logout Servico Whastapp MEGA '
@ 09,11 PROMPT '3-Gerar QRcodi '
@ 11,11 PROMPT '4-Enviar uma Mensagem Teste para o JAF '
@ 13,11 PROMPT '5-Enviar Mensagem AVulso '
@ 15,11 PROMPT '6-Robo de envio de ZAP ( MSGZAP.DBF) '
@ 17,11 PROMPT '7-Marca todos os Contatos '
@ 19,11 PROMPT '8-Descamarca todos os Contatos '
@ 21,11 PROMPT '9-Checa todos contato com zap ou sem '
@ 23,11 PROMPT '10-VOLTA MENU '
menu to opcao
Do case
case opcao==10
Exit
case opcao==1
Alerta(iif(Zap_VerStatus()==.t.,'Ok-Operando','Offline'))
case opcao==2
ZAP_Logout()
case opcao==3
ZAP_PegaQrCodi()
case opcao==4
EnviarMsgTexto("14997140865",'JAF, mensagem de teste!','',.t.)
case opcao==5
Zap_avulso()
case opcao==6
Alerta(iif(Zap_VerStatus()==.t.,'Ok-Operando','Offline'))
RoboZap()
ALERT('PROCESSO FINALIZADO... ',{'ENTER FINALIZA!'},'W/BR+',10)
QUIT
case opcao==7
MarcaTodos()
case opcao==8
DesMarcaTodos()
case opcao==9
ChecaTodosContatos()
EndCAse
Enddo
Restscreen(00,00,MaxRow(),MaxCol(),tela01 )
return nil
//------------------------------------------------
Static Function Zap_avulso()
Local cMsg := Space(100)
Local cNumero := Space(12)
Local GetList := {}
If Zap_VerStatus()==.f.
Alerta('Verifique o celular, não esta online/Conectado!')
Return nil
Endif
CAIXATEXTO(10,5,15,90,"....### MENSAGEM A VULSO ZAP ###...2","BG+/NB+","NN/NN","D")
@ 12,06 say 'Nr. Celular com WhatsApp :' Get cNumero pict '999999999999'
@ 14,06 say 'Mensagem:' Get cMsg
Read
IF MSGCONF("Enviar Mensagem ","1") == .t.
EnviarMsgTexto(Alltrim(cNumero),Alltrim(cMsg),'',.t.)
Endif
FechaJanela()
Return Nil
//------------------------------------------------
Static Function Zap_Envia_Pasta(cNumero)
Local nLista := Directory("c:\temp\Zap\*.jpeg","D")
Local i
Local lok := .t.
For i:= 1 To Len(nLista)
cArquivo := 'c:\temp\zap\'+nLista[i,1]
lok:= EnviarMsgTexto(cNumero,'Ofertas La Villa!!!',cArquivo,.f.,.t.)
IF HHasKey( hHash, 'message' )
Trav_reg()
Repla Lista->RETORNO With ALLTRIM(hHash['message'])
Centra(24,'Enviando Whastapp....'+cNumero+' RETORNO....'+ALLTRIM(hHash['message']) )
ENDIF
IF HHasKey( hHash, 'accountStatus' )
Trav_reg()
Repla Lista->DATAENV With Dtoc(Date())+' '+Time()
ENDIF
*Destrava()
If lOk == .f.
Exit
Endif
Next
Return lok
Function Centra(l,c)
@ MaxRow(),00 say padc(c,MaxCol()) Color('WW+/RR+')
Return Nil
Function Alerta(c)
Alert(c)
return nil
Function MSGCONF(c)
Local op := 2
If op:= Alert(c,{'SIM','NAO'})==1
Return .t.
endif
return .f.
Function CAIXATEXTO(l1,c1,l2,c2,c)
@ l1,c1 clear to l2,c2
@ l1-1,c1 say c
return nil
Function FechaJanela()
return .t.
//---------------------------------------------------
Static Function MarcaTodos()
Local nQtd := 100
Local nreg := 0
Local TELA01 := SAVESCREEN(00,00,MaxRow(),MaxCol())
Local cMsg := "La Villa, Ofertas!"+SPACE(100)
SETCOLOR('W/NN')
CLEAR
@ 09,10 say padc('PREENCHA DADOS PARA ENVIO ',80) COLOR('W/G+')
@ 10,10 SAY 'QUANTIDADE DE CONTATOS POR VEZ?' GET NQTD PICT '999999'
@ 10,10 say 'MENSAGEM ==>'
@ 12,10 Get cmsg PICT "@S70"
READ
if lastkey()#27
IF MSGCONF("Confirma MARCAO ! ","1") == .t.
Go top
Do while !Eof()
if ! Empty(Contato->DataEnv) .and. nReg <= nQtd
Trav_reg()
Repla Contato->DataEnv With ''
Repla Contato->MSg With cMsg
Repla Contato->Arquivo With 'PASTA'
nreg++
Endif
Skip+1
Enddo
Commit
Endif
Endif
Restscreen(00,00,MaxRow(),MaxCol(),tela01 )
Return nil
//---------------------------------------------------
Static Function DesMarcaTodos()
IF MSGCONF("Confirma DESMARCACAO DE TODOS ! ","1") == .t.
Go top
Do while !Eof()
Trav_reg()
Repla Contato->DataEnv With DTOC(DATE())
Repla Contato->MSg With ''
Repla Contato->Arquivo With ''
Skip+1
Enddo
Commit
Endif
Return nil
//------------------------------------------------------------
Static Function PESQNOME()
Local TELA01 := SAVESCREEN(00,00,MaxRow(),MaxCol())
Local cPesquisa:= Space(50)
SETCOLOR('W/NN')
CLEAR
@ 09,10 say padc('PESQUISA POR NOME',80) COLOR('W/G+')
@ 10,10 Get cPesquisa PICT "@S70"
READ
if lastkey()#27
IF MSGCONF("Confirma PESQUISA! ","1") == .t.
cPesquisa:= upper(Alltrim(cPesquisa))
Set filter to cPesquisa$Nome
Go top
Else
set filter to
Endif
Endif
Restscreen(00,00,MaxRow(),MaxCol(),tela01 )
Return nil
//--------------------------------------------
Function GravaLog(cMsg)
Local cFileName := "c:\temp\logzap.txt"
Local hFile, cLine := "", n
Local cFieldAnt
Local CRLF := Chr(13)+Chr(10)
//cLine := Dtoc(Date())+' '+Time()+CRLF
cLine := cMsg +Time()+CRLF
If ! File( cFileName ) // Caso nao tenha cria o arquivo
FClose( FCreate( cFileName ) )
Endif
Do Whil .T.
If ( ( hFile := FOpen( cFileName, 1+16 ) ) # -1 )
FSeek( hFile, 0, 2 )
FWrite( hFile, cLine, Len( cLine ) )
FClose( hFile )
Exit
Else
Exit
Endif
Enddo
Retu(.T.)
//------------------------------------------------------------------
Function Zap_checaContato(cNumero)
Local i
Local Url :='http://api2.megaapi.com.br:15358/'// sendfilebase64?'
Local cToken := "M_CI33zodtF1UisZAD"
Local cRetorno :=''
Local mTemporal_:= 'c:\temp\'
Local cMsg := 'testa contato'
hHash := Hash()
Url += 'checknumber?'
Url += "token="+cToken
*xmldoc = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")
xmldoc = CREATEOBJECT("MSXML2.ServerXMLHTTP")
xmldoc:setTimeouts(1000*60, 1000*60, 0, 0)
xmldoc:open("POST", url, .f.)
xmldoc:SetRequestHeader( "Content-Type", "application/json;charset=utf-8" )
xmldoc:SetRequestHeader( "token" , cToKen )
* Alert("Erro ao chamar metodo SEND de HttpRequest (Registro envio)"+chr(10)+cErrorTmp )
lErroEnvio := .t.
End
If lErroEnvio == .t.
Return .f. // cErrorTmp
Endif
DO WHILE xmldoc:readyState <> 4
MILLISEC(1000)
ENDDO
Linha :=xmldoc:responseText
Linha2:=xmldoc:ResponseBody()
IF VALTYPE(hHash) != 'H'
* Alert( 'Algo deu errado, verifique Endereço/token da API')
RETURN(.F.)
ENDIF
IF len(hHash)<0
*Alert('Algo deu errado, verifique Endereço/token da API ou retorno vazio, tente novamente')
RETURN(.F.)
ENDIF
IF HHasKey( hHash, 'accountStatus' )
Trav_reg()
If hHash['accountStatus']==.f.
Repla Contato->retorno With hHash['message']
Repla Contato->Temzap With 'NT'
Else
Repla Contato->retorno With hHash['message']
Repla Contato->Temzap With 'OK'
Endif
Endif
RETURN .t.
//---------------------------------------------------------------------
Static Function ChecaTodosContatos()
Local nReg := Reccount()
Local nAtu := 1
If Zap_VerStatus()==.f.
Alerta('TEM QUE ESTA ATIVO O CELULAR?')
Return nil
Endif
IF MSGCONF("Confirma Analise de todos os contatos ! ","1") == .t.
Go top
Do while !Eof()
If !Empty(Contato->TemZap)
Skip+1;Loop
Endif
Centra(24,'Aguarde.. o termino.....'+Contato->Telefone+' Aguarde...'+Str(natu++,5)+'/'+Str(nReg,5))
Zap_checaContato(Contato->Telefone)
Skip+1
Enddo
Endif
Commit
Return nil
Boa tarde , nós usamos https://mega-api.app.br/
Preços:
BÁSICO
99,90/mês
A partir de 1 número
Todas as formas de pagamento
MEGA TOKEN 10
69,90
Acima de 10 números
Valor mensal por número
GRANDE VOLUMES
MEGA TOKEN 50
55,00
Acima de 50 números
Valor mensal por número
GRANDE VOLUMES
MEGA TOKEN 100
45,00
Acima de 100 números
Valor mensal por número
GRANDE VOLUMES
MEGA TOKEN 500
30,00
Acima de 500 números
Valor mensal por número
Faça uma Matriz com as opções. Por ex.:
mItem :={"A vista","A Vista 20%","---------------------","A prazo","A prazo 1X","A prazo 2X","Aprazo 3X","A Prazo 4X","-------------------------","Cartão Debito","Cartão Debito 1X"}
Se For com resource ---> Redefine ComboBox oCbx Var mItem[1] ID 101 ITEMS mIte Font oFnt ON Change Alias->(DbSetOrder(oCbx:nAT) )
// C:\FWH..\SAMPLES\SYSIDLE.PRG - By Jose Alvarez.
// MOD. EN: 08/11/2022 By kapiabafwh@gmail.com - Sao Paulo - Brasil.
#include "FiveWin.ch"
/*
// function to exit the app when default 'x' number of seconds pass with no activity
// from the keyboard or mouse.
// attention! IT IS NOT THE TIME without activity of our application, it is the inactive time of the PC
// función para salir de la aplicación cuando pasan 'x' cantidad de segundos predeterminados sin actividad
// del teclado o raton.
// ¡atención! NO ES EL TIEMPO sin actividad de nuestra aplicacion, es el tiempo inactivo de la PC
// função para sair do aplicativo quando o número padrão 'x' de segundos passa sem atividade
// do teclado ou mouse.
// atenção! NÃO É O TEMPO sem atividade do nosso aplicativo, é o tempo inativo do PC
*/
STATIC oDlg, oFont, oTimerExit
STATIC nInterval
MEMVAR nSecondsToOut
FUNCTION Fnct_Prueba()
LOCAL oGet1, oBtnX2, cTitle, aGrad, oSay
LOCAL cVar1 := [SYSIDLE.PRG: BY JOSE ALVAREZ. ]
HB_GCALL( .F. )
nSecondsToOut := 55 // (segundos)
nInterval := 1 * 60000 //(1 x 60000 = 1 minuto)
aGrad := { { 0.30, CLR_WHITE, CLR_HCYAN },{ 0.30, CLR_WHITE, CLR_HCYAN } }
cTitle := "MOVE MOUSE: PRUEBA DE SYSIDLE.PRG: BY JOSE ALVAREZ"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14
DEFINE DIALOG oDlg SIZE 600, 200 PIXEL TRUEPIXEL RESIZABLE ;
TITLE cTitle GRADIENT aGrad FONT oFont
@ 050, 10 GET oGet1 VAR cVar1 bitmap "..\bitmaps\chkyes.bmp" ;
OF oDlg PIXEL SIZE 300, 24 FONT oFont ;
ACTION( NIL )
oGet1:lBtnTransparent := .T. // transparent button get oGet1
oGet1:lAdjustBtn := .T. // Button Get Adjust Witdh oGet3
oGet1:lDisColors := .F. // Deactive disable color
oGet1:nClrTextDis := CLR_WHITE // Color text disable status
oGet1:nClrPaneDis := CLR_BLUE // Color Pane disable status
@ 095, 10 SAY oSay PROMPT "This a Test: No Move Mouse Wait 1 Minute." ;
OF oDlg SIZE 150, 14 COLOR CLR_BLACK, CLR_WHITE PIXEL FONT oFont ;
TRANSPARENT ADJUST
@ 120, 250 BTNBMP oBtnx2 SIZE 60, 60 PIXEL OF oDlg FLAT NOBORDER ;
PROMPT "Exit" FILENAME "..\bitmaps\16x16\Exit.bmp" BOTTOM ;
COLOR CLR_BLACK, nRgb( 238, 236, 219 ) ACTION( oDlg:End() )
oBtnX2:lCancel := .T.
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oGet1:SetFocus(), Fnct_StartCounterTime() )
RETURN NIL
FUNCTION Fnct_StartCounterTime ()
DEFINE TIMER oTimerExit OF oDlg INTERVAL nInterval ;
ACTION ( IIF( sysIdleSecs() > nSecondsToOut, fExit(), ) )
oTimerExit:Activate()
RETURN NIL
FUNCTION fExit()
oTimerExit:Deactivate()
oTimerExit:End()
MsgAlert( 'Tu Sesión Finalizó Por Inactividad.', 'Fin de Sesión' )
oDlg:End()
RELEASE FONT oFont
FreeResources()
Release All
SysRefresh()
HB_GCALL( .T. )
CLEAR MEMORY
PostQuitMessage( 0 )
QUIT
RETURN NIL
// typedef struct tagLASTINPUTINFO {
// UINT cbSize;
// DWORD dwTime;
// } LASTINPUTINFO, *PLASTINPUTINFO;
#pragma BEGINDUMP
#define _WIN32_WINNT 0x0500
#define WINVER 0x0500
#include "windows.h"
#include "hbapi.h"
WINUSERAPI BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO);
typedef BOOL (WINAPI *GETLASTINPUTINFO_)(PLASTINPUTINFO);
HB_FUNC( SYSIDLESECS )
{
HINSTANCE handle = LoadLibrary("USER32.dll");
if ( handle)
{
GETLASTINPUTINFO_ pFunc;
pFunc = GetProcAddress( handle,"GetLastInputInfo" );
if (pFunc)
{
LASTINPUTINFO lpi;
lpi.cbSize = sizeof(LASTINPUTINFO);
if (!pFunc(&lpi))
{
hb_retni(0);
}
else
{
hb_retnd( ( DOUBLE ) ( GetTickCount() - lpi.dwTime ) * 0.001 );
}
}
else
{
hb_retni(0);
}
}
if (handle)
{
FreeLibrary( handle);
}
}
#pragma ENDDUMP
// FIN / END
Regards, saludos.
Precisei agora, e realmente essa bagaça não funciona. Criei um tópico no inter aqui:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=42578&sid=103749f3da5feb59419686288a1a5dc7
Regards, saludos.
Amiguinhos,
Eis uma tabela de códigos IBGE completissima com 10.649 cidades, municipios com codificação completa de 9 dígitos.
Download (arquivo DBF e SQL )