fluna Posted December 3, 2019 Report Share Posted December 3, 2019 Tenho uma rotina em que abro uma página web para mandar recado para clientes no whatsapp; o problema é que ele abre várias janelas em vez de usar uma que já está aberta; if ..... // já existe janela aberta * * Else oShell:run("https://web.whatsapp.com/send?phone="+cPara) ; Sleep(nSecs) Endif Alguém poderia me ajudar a resolver isso? Tipo, se a página já está aberta, usá-la em vez de abrir outra no navegador Obrigado. Quote Link to comment Share on other sites More sharing options...
ADutheil Posted December 4, 2019 Report Share Posted December 4, 2019 Quando usava childwindows colocava uma variável estática no inicio do PRG. #include fivewin.ch STATIC nJane FUNCTION XXXX LOCAL oWndChild IF nJane = NIL DEFINE WINDOW oWndCh CHILD OF wndMain() TITLE .... . . . ACTIVATE WINDOW oWndChild VALID ( nJane :=NIL ) ON INIT ( nJane := 1) ELSE oWndChild:Restore() ENDIF Quote Link to comment Share on other sites More sharing options...
fluna Posted December 4, 2019 Author Report Share Posted December 4, 2019 Me desculpe, adutheil; talvez eu não tenha me expressado corretamente. A janela a que me refiro é uma página web. O script abre uma nova página web, mesmo que a mesma já esteja aberta no navegador... Ex: estou com a página do whatszap aberta, mas quando executo o sistema abre outra página do whats em vez de usar a que está aberta. De qualquer maneira, obrigado pela ajuda. Quote Link to comment Share on other sites More sharing options...
ADutheil Posted December 4, 2019 Report Share Posted December 4, 2019 Não pode fechar tipo oShell:end() depois de mandar a mensagem? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 4, 2019 Report Share Posted December 4, 2019 Tente utilizar oShell:Exec. Quote Link to comment Share on other sites More sharing options...
sygecom Posted December 4, 2019 Report Share Posted December 4, 2019 Fabio Luna, boa noite. Estou esperando aquele contato mestre, desde: 09/08/2016 10:00, ultimo e-mail que recebi seu...kkkkkkk fluna 1 Quote Link to comment Share on other sites More sharing options...
fluna Posted December 4, 2019 Author Report Share Posted December 4, 2019 Grande mestre léo! Salve salve... (saudades... -verdade!) andei "parado" uns tempos voltei à ativa a alguns meses atrás. Tô na pista de novo rssss meu número: (63) 992618619 (whatsapp). Se eu puder ser útil, é só contactar. Quote Link to comment Share on other sites More sharing options...
fluna Posted December 4, 2019 Author Report Share Posted December 4, 2019 Como ficou: ************************** Function Whatsapp( cPara ) ************************** Local oShell,wCodCli,lSair,lOk If !IsInternet() MsgInfo("Necessário Uma Conexão com Internet !"+CRLF+"Operação cancelada") Return(.f.) Endif wCodCli:=alltrim(right(cpara,5)) Select cli cli->(OrdSetFocus("codigo")) seek wcodcli lOk:=found() Select SRV if !lok ? "Erro! cliente não encontrado on cadastro!" return(.f.) endif cPara:=alltrim(CLI->FONE_MOVEL) cNome:=alltrim(CLI->NOME) CursorWait() nSegs:=val(GetPvProfString("WhatsApp","SecWaitPage","0",SysArq)) cMens:=GetPvProfString("WhatsApp","MsgPrinting" ," ",SysArq) cSair:=GetPvProfString("WhatsApp","FechaNavegador" ," ",SysArq) If empty(nSegs) nSegs:=10 // 10 segundos WritePProString( "WhatsApp","SecWaitPage","10",SysArq ) Endif If empty(cMens) cMens:="Avisamos que O SEU APARELHO ja esta disponivel! Voce ja pode vir retira-lo." WritePProString( "WhatsApp","MsgPrinting",cMens,SysArq ) Endif If empty(cSair) cSair:="S" WritePProString( "WhatsApp","FechaNavegador","S",SysArq ) Endif cPara:=AjustaFone( cPara ) If Empty( cPara ) MsgInfo("Número do telefone de "+cNome+" inválido, verifique!") return(.f.) endif cHora:=Time() nHora:=val(substr(cHora,1,2)+substr(cHora,4,2)) cHora:=iif(nHora>=0000 .and. nHora <=1200 ,"Bom Dia, " , "" ) cHora:=iif(nHora>=1201 .and. nHora <=1800 ,"Boa Tarde, ",cHora) cHora:=iif(nHora>=1801 .and. nHora <=2359 ,"Boa Noite, ",cHora) cCabc:= cHora+"A "+wNomeEmpresa+" tem um recado para voce!" oShell:= CreateObject( "WScript.Shell" ) oShell:run("https://web.whatsapp.com/send?phone="+cPara) WaitSeconds(nSegs) oShell:sendkeys("*"+cCabc+"*") ; WaitSeconds( 3 ) ; oShell:SendKeys("~") ; WaitSeconds( 1 ) oShell:sendkeys("_"+cMens+"_") ; WaitSeconds( 3 ) ; oShell:SendKeys("~") ; WaitSeconds( 1 ) oShell:sendkeys("*Nosso contato: "+wFoneEmpresa+"*") ; WaitSeconds( 3 ) ; oShell:SendKeys("~") ; WaitSeconds( 3 ) If cSair="S" oShell:SendKeys("%{F4}") // ALT+F4 fecha o navegador, mas deixar aberto fica mais rápido.... Endif CursorArrow() Return nil ***************************** FUNCTION AjustaFone( xFone ) ***************************** Local i,cLetra,cFone:="" For i=1 to len(xFone) cLetra:=Substr(xFone,i,1) cFone+=iif(cLetra="0","0",iif( val(cletra)>0,cLetra,"")) Next If Substr(cFone,1,2)#"55" cFone:="55"+cFone Endif cFone:=alltrim(cFone) If len( cFone ) # 13 cFone:=" " endif Return( cFone ) zekasan 1 Quote Link to comment Share on other sites More sharing options...
fluna Posted December 4, 2019 Author Report Share Posted December 4, 2019 Obrigado a todos, boa noite. Quote Link to comment Share on other sites More sharing options...
sygecom Posted December 5, 2019 Report Share Posted December 5, 2019 Legal Fabio,amanhã te chamo. Abraços Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.