terça-feira, 28 de março de 2017

Aula 1104 - Windev - String 37/... - Separar Texto por Cr e colocar tabela









Video no Youtube Se Gostou clique aqui para dar joinha



https://doc.windev.com/en-US/?1510013&name=FOR_ALL



Blog - WinDev - Curso String - 001/... - Zeros direita - Rigth
Blog - WinDev - Curso String - 002 - Retirar texto Bloco String
Blog - WinDev - Curso String - 003 - Tamanho das Strings - Length
Blog - WinDev - Curso String - 004 - Transformar String Base 654 Em pdf
Blog - WinDev - Curso String - 005 - Retirar Texto do Lado Esquerdo e Direito
Blog - WinDev - Curso String - 006 - Complet - Completar Strings - Remessa Banco
Blog - WinDev - Curso String - 007 - Contains - Contem
Blog - WinDev - Curso String - 008 - Tirar pontos Cnpj - Replace
Blog - WinDev - Curso String - 009 - String - Placa - LLL9999
Blog - WinDev - Curso String - 010 - StringBuild
Blog - WinDev - Curso String - 011 - StringFormat
Blog - WinDev - Curso String - 012 - StringIncrement
Blog - WinDev - Curso String - 013 - Tirando Enter Observação
Blog - WinDev - curso String - 014 - Rtf - Colorir String
Blog - WinDev - Curso String - 015 - Multilinhas Strings
Blog - WinDev - Curso String - 016 - Numeracao Campo Dim
Blog - WinDev - Curso String - 017 - Numeracao - Juntar Numeracao e Pares
Blog - WinDev - Curso String - 018 - RTF - Posicionar e Colorir
Blog - WinDev - Curso String - 019 - Array guadar e ler codigo/nome - Associative Array
Blog - WinDev - Curso String - 020 - Array - Ver Se Existe -: ..exists 
Blog - WinDev - Curso String - 021 - Campo - Posicionar Campo no Final - Cursor - Setfocus
Blog - WinDev - Curso String - 022 - Cep Formatar
Blog - WinDev - Curso String - 023 - Rtf Somar Quantas Linhas
Blog - WinDev - Curso String - 024 - ExtracLine - Extrair Linha
Blog - WinDev - Curso String - 025 - Contains - Ver se Tem dentro String
Blog - WinDev - Curso String - 026 - NoSpace - Elimina Espacos
Blog - WinDev - Curso String - 027 - Lower - Minusculo
Blog - WinDev - Curso String - 028 - Replace - Substituir
Blog - WinDev - Curso String - 029 - Upper - Maiuscula
Blog - WinDev - Curso String - 030 - Middle
Blog - WinDev - Curso String - 031 - NoSpace
Blog - WinDev - Curso String - 032 - RepeatString
ChaîneDécoupe - Blog - WinDev - Curso String - 033 - Extrai String com Separador
Blog - WinDev - Curso String - 034 - NoCharacter
Blog - WinDev - Curso String - 035 - StringCount - Quantos tem na pesquisa
Caixa - Fazer uma Caixa - String 036/...
For Each - Separar texto com Cr - WinDev String 037/...
RETIRAR TEXTO - WINDEV STRING 038 - AULA 1226




Nessa aula de hoje
vou mostrar como pegar um edt texto
e separar cada linha com cr
e adicionar numa tabela

In this class today
I'll show you how to get an edt text
And separate each row with cr
And add in a table







TableDeleteAll(TABLE_Texto)
// Limpando dados da tabela antes de preenche-la
// Clearing Table Data Before Filling It

FOR EACH STRING s_LINHA OF EDT_Texto SEPARATED BY CR
    // Vou percorrer a string edt texto separando por Enter=Cr
    // I'll go through the edt text string separating by Enter = Cr
   
    TableAddLine(TABLE_Texto,s_LINHA)
    // Estou adicionando a tabela, a linha encontrada
    // I am adding the table, the row found
   
END


















segunda-feira, 27 de março de 2017

Aula 1103 - Windev - Certificado 011/... - DonwLoad Arquivo/Barra Progresso/Http









Video no Youtube Se Gostou clique aqui para dar joinha



Nessa aula de hoje
vou ensinar a fazer DownLoad Arquivo
usar Barra de Tarefas com
Http




http://doc.windev.com/en-US/?3043004&name=http_functions

https://doc.windev.com/en-US/?3043009&name=HTTPProgressBar   
https://doc.windev.com/en-US/?3043007&name=httprequest_function
https://doc.windev.com/en-US/?3043001&name=HTTPGetResult
https://doc.windev.com/en-US/?1514042&name=Buffer_type
https://doc.windev.com/en-US/?1000019412&name=fSaveBuffer



Blog - WinDev - Curso Certificado - 001/... - Seleciona Certificado - Certificate Select 
Blog - WinDev - Curso Certificado - 002/... - Certificate Type - Pegar Dados Certificado
Blog - WinDev - Curso Certificado - 003/... - Ver se Certificado é Válido
Blog - WinDev - Curso Certificado - 004/... - CertificateLoad - Chamar pfx/arquivo
Blog - WinDev - Curso Certificado - 005/... - Assinatura Digital Nfe - Parte 1/...
Blog - WinDev - Curso Certificado - 006/... - Assinatura nfe - Parte 2/... - System.xml.xmlDocument
Blog - WinDev - Curso Certificado - 007/... - Assinatura nfe - Parte 3/... - Assinar Documento
Blog - Windev - Curso Certificado - 008/... HttpListCertificate
Blog - WinDev - Curso Soap - 009/... Consulta Cadastro Sefaz - WebService
Blog - WinDev - Curso Soap - 010 - Status Nfe Sefaz - WebService
DonwLoad Arquivo/Barra progresso/Http - WinDev - Certificado 011/...
CertificateSelect - DICAS 1955 - PUBLICA - WINDEV - Certificado 12 -


//Com comentarios

b_fazer_download is boolean=True
// Criando uma Variavel Chamado fazer donwLoad e sera verdadeiro ou falso
// Creating a Callable Variable make donwLoad and will be true or false
_arquivo_existe is boolean = fFileExist("d:\amarildo\dll_dia_233.zip") 
// Criando Variavel arquivo existe que sera verdadeiro ou falso e vou verificar se o arquivo existe
// Creating Variable file exists that will be true or false and I will check if the file exists
IF _arquivo_existe=True THEN  // Se arquivo existe for igual a verdadeiro
    IF YesNo("Arquivo já existe, deseja refazer download?") THEN
        // Estou perguntando se desejo fazer download    
    ELSE //Senao
        b_fazer_download=False   
        // dizendo que fazer download é igual a falso
    END   
END
IF b_fazer_download=True THEN
    //Se fazer donwload for igual a verdadeiro
    PROGBAR_download..Visible=True
    // tornando visivel a barra de progresso
    HTTPProgressBar(PROGBAR_download)
     // Mostra Barra de tarefa enquanto estiver executando Consulta Http
     // Show Taskbar while running httpProgressBar   
    _arquivo is boolean = HTTPRequest("http://www.matosinformatica.com.br/Arquivos/dll_dia_233.zip")
    // Inicia uma solicitação HTTP em um servidor. O resultado da consulta pode ser:
    //    Salvo em um arquivo de backup por HTTPDestination
    //    Recuperado por HTTPGetResult .       
    // Starts an HTTP request on a server. The result of the query can be:
    //    Saved in a backup file by HTTPDestination
    //    Recovered by HTTPGetResult 
    HTTPProgressBar("")
    // Cancela barra progresso
    // Cancel progress bar
    IF _arquivo = True THEN
        // Se arquivo for igual a verdadeiro
        // If file is equal to true
        _baixar_arquivo is Buffer = HTTPGetResult()   
        // buffer = O tipo de buffer corresponde a uma zona de memória binária       
        // HTTPGetResult = Recupera o resultado ou o cabeçalho da última execução de solicitação HTTP.
        // Esta solicitação foi iniciada por HTTPRequest ou por HTTPSendForm        
        // Buffer = The buffer type corresponds to a binary memory zone
         // Retrieves the result or the header of the last HTTP request execution.
         // This request was initiated by HTTPRequest or by HTTPSendForm        
        _arquivo = fSaveBuffer("d:\amarildo\dll_dia_233.zip",_baixar_arquivo)  // fSaveBuffer = Cria e preenche um arquivo externo com o conteúdo de uma string
         // ou variável de buffer. Se o arquivo já existir, ele será excluído e recriado
         // FSaveBuffer = Creates and fills an external file with the contents of a string
         // Or buffer variable. If the file already exists, it will be deleted and recreated.
        IF _arquivo = True THEN
            Info("Download efetuado com sucesso!'") // Se arquivo for verdadeiro, sucesso donwload // If file is true, download success
        ELSE
            Error("Não foi possivel efetuar o download.")    // Senão deu erro // Otherwise,
        END  
    END       
END




//Sem Comentarios

b_fazer_download is boolean=True
_arquivo_existe is boolean = fFileExist("d:\amarildo\dll_dia_233.zip") 
IF _arquivo_existe=True THEN  // Se arquivo existe for igual a verdadeiro
    IF YesNo("Arquivo já existe, deseja refazer download?") THEN
    ELSE //Senao
        b_fazer_download=False   
    END   
END
IF b_fazer_download=True THEN
    PROGBAR_download..Visible=True
    HTTPProgressBar(PROGBAR_download)
    _arquivo is boolean = HTTPRequest("http://www.matosinformatica.com.br/Arquivos/dll_dia_233.zip")
    HTTPProgressBar("")
    IF _arquivo = True THEN
        _baixar_arquivo is Buffer = HTTPGetResult()   
        _arquivo = fSaveBuffer("d:\amarildo\dll_dia_233.zip",_baixar_arquivo)  // fSaveBuffer = Cria e preenche um arquivo externo com o conteúdo de uma string
        IF _arquivo = True THEN
            Info("Download efetuado com sucesso!'") // Se arquivo for verdadeiro, sucesso donwload // If file is true, download success
        ELSE
            Error("Não foi possivel efetuar o download.")    // Senão deu erro // Otherwise,
        END  
    END       
END






















domingo, 26 de março de 2017

Html Ler HttpGetResult

HttpGetResult - http://forum.pcsoft.fr/pt-BR


http://doc.windev.com/?3043001&lang=en-US&productversion=xxA190056s


http://forum.pcsoft.fr/pt-BR/pcsoft.br.windev/116-exemplos-uso-httprequest-httpgetresult/read.awp







----------------------------------------------------------------------------------------------------------------------

 Examples
Ex01: Retorna Html
#####################################################
Code Button:

Url is string = "http://www.informaticon.com.br"
ok is boolean = HTTPRequest(Url)
IF ok = True
Info(ok )
retorno is string = HTTPGetResult()
ELSE
Info(ErrorInfo())
END

Ex02: Retorna Header DO Html
#####################################################
Code Button:

Url is string = "http://www.informaticon.com.br"
ok is boolean = HTTPRequest(Url)
IF ok = True
Info(ok )
retorno is string = HTTPGetResult(httpHeader)
ELSE
Info(ErrorInfo())
END

Ex03: Retorna Cookie
#####################################################
Code Button:

Url is string = "http://www.informaticon.com.br"
ok is boolean = HTTPRequest(Url)
IF ok = True
Info(ok )
retorno is string = HTTPGetResult(httpCookie)
ELSE
Info(ErrorInfo())
END

Ex04: Retorna html
#####################################################
Code Button:

Url is string = "http://www.informaticon.com.br"
ok is boolean = HTTPRequest(Url)
IF ok = True
Info(ok )
retorno is string = HTTPGetResult(httpResult)
ELSE
Info(ErrorInfo())
END

Ex05: Retorna uma imagem (download de arquivo)
#####################################################
Code Button:

ArquivoBaixado is Buffer

Url is string = "http://www.informaticon.com.br/j/images/stories/neri.jpg"

ok is boolean = HTTPRequest(Url)

IF ok = True
ArquivoBaixado = HTTPGetResult()
ELSE
Info(ErrorInfo())
END

fSaveBuffer("c:\fotodonerigaldeiro.jpg",ArquivoBaixado)

Ex06: Retorna uma executavel (download de arquivo)
#####################################################
Code Button:

ArquivoBaixado is Buffer

Url is string = "http://www.7-zip.org/a/7z920.exe"

ok is boolean = HTTPRequest(Url)

IF ok = True
ArquivoBaixado = HTTPGetResult()
ELSE
Info(ErrorInfo())
END

fSaveBuffer("7z920.exe",ArquivoBaixado)

Ex07: Envelope SOAP
#####################################################
Code Button:
PROCEDURE WS_Taxi_AtualizarCartoes(LOCAL DebugSN)

IF GloDebugSN = "S" THEN
    Info("WS_Taxi_AtualizarCartoes")
    DebugSN = "S"
END

ok is boolean = False

Contador is int = 0

bAtualizar is boolean = False

IpSaladaFruta01 is string = Morango_01 +"."+ Abacaxi_02 +"."+ Limao_03 +"."+ Melancia_04 +":"+ Laranja_05
IpSaladaFruta02 is string = Morango_01 +"."+ Abacaxi_02 +"."+ Limao_03 +"."+ Melancia_04 +":"+ Manga_06

ChangeCharset(charsetOccidental) // SEM ACENTO

//Busca Cliente
HReadSeekFirst(t001_cliente,t001_cliente.t001_seq_cliente,1)
IF HFound(t001_cliente) = True THEN
   
    erro is int = 0
    CodClienteCelula, nRetornoCodigo is int = 0
    bRet is boolean = False
    XML_Retorno, NumProces is string = ""
   
    //Busca Cliente
    HReadSeekFirst(t001_cliente,t001_cliente.t001_seq_cliente,1)
    IF HFound(t001_cliente) = True THEN
       
        //NumProcess
       
        NumProces = WS_Taxi_ValidaRequisicao(t001_cliente.t001_ddd_telefone,...
        t001_cliente.t001_num_telefone,...
        0,...
        0,...
        "N")
       
       
        //Envio
        IF CodClienteCelula = "" OR CodClienteCelula = 0 THEN
            CodClienteCelula = t001_cliente.t001_cod_clientecelula
        END
       
        //Envelope
        Xml_SEND is string = [
            <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM#AtualizarCartoes">
            <soapenv:Header/>
            <soapenv:Body>
            <urn:AtualizarCartoes soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <cod_client_celula xsi:type="xsd:int">v001</cod_client_celula>
            <dat_hora_proces xsi:type="xsd:string">v002</dat_hora_proces>
            <num_proces xsi:type="xsd:int">v003</num_proces>
            </urn:AtualizarCartoes>
            </soapenv:Body>
            </soapenv:Envelope>
        ]
       
       
        //Replace
        Xml_SEND = Replace(Xml_SEND,"v001",CodClienteCelula,IgnoreCase)
        Xml_SEND = Replace(Xml_SEND,"v002",GloDataHora,IgnoreCase)
        Xml_SEND = Replace(Xml_SEND,"v003",NumProces,IgnoreCase)
       
        IF DebugSN = "S" THEN
            Info("/mnt/sdcard/TaxiFv/Arquivos/EnvioCartoes.TXT", Xml_SEND)
            IF InAndroidMode() = True
                IF InSimulatorMode() = False
                    fSaveBuffer("/mnt/sdcard/TaxiFv/Arquivos/EnvioCartoes.TXT", Xml_SEND)
                ELSE
                    fSaveBuffer("c:\EnvioCartoes.TXT", Xml_SEND)
                END
            END
        END
       
        HTTPTimeOut(GloHTTPTimeOut)
       
        //BASE REAL
       
        ok = HTTPRequest("http://"+IpSaladaFruta01+"/soap/IRtPlusSSDM","", "", Xml_SEND, "text/xml","","")
       
        XML_Retorno = WS_Android_IOS_HTTPGetResult()
       
        //Retorno Completo do webservice sem Tratamento
        IF DebugSN = "S" THEN
            Info("/mnt/sdcard/TaxiFv/Arquivos/RetornoCartoesSemTratamento.TXT", XML_Retorno)
            IF InAndroidMode() = True
                IF InSimulatorMode() = False
                    fSaveBuffer("/mnt/sdcard/TaxiFv/Arquivos/RetornoCartoesSemTratamento.TXT", XML_Retorno)
                ELSE
                    fSaveBuffer("c:\RetornoCartoes.TXT", XML_Retorno)
                END
            END
        END
       
        //Retorno Completo do webservice com Tratamento
        XML_Retorno = WS_RemoveAcentos(XML_Retorno)
       
        //Ajuste do xml para ser lido
        IF Length(XML_Retorno) > 0 THEN
           
            Inicial is int = PositionOccurrence(XML_Retorno,"<NS2:TTipoFormaPagamentoVO",firstRank,FromBeginning)
            Final is int = PositionOccurrence(XML_Retorno,"</NS2:TTipoFormaPagamentoVO>",lastRank,FromEnd) +Length("</NS2:TTipoFormaPagamentoVO>")
            XML_Retorno = Middle(XML_Retorno,Inicial,Final - Inicial)
            XML_Retorno = Replace(XML_Retorno,"NS2:TTipoFormaPagamentoVO","NoXml")
            XML_Retorno = "<Xml><Recorte>"+XML_Retorno+"</Recorte></Xml>"
           
            IF DebugSN = "S" THEN
                Info("/mnt/sdcard/TaxiFv/Arquivos/RetornoCartoes.TXT", XML_Retorno)
                IF InAndroidMode() = True
                    IF InSimulatorMode() = False
                        fSaveBuffer("/mnt/sdcard/TaxiFv/Arquivos/RetornoCartoes.TXT", XML_Retorno)
                    ELSE
                        fSaveBuffer("c:\RetornoCartoes.TXT", XML_Retorno)
                    END
                END
            END
           
            IF Length(XML_Retorno) >0 THEN
               
                HExecuteQuery(QRY_T004Cartoes_Del)
                FOR EACH t004_cartoescreditos
                    HDelete(t004_cartoescreditos)
                END
               
                IF IniOSMode() = True THEN
                    /////////////////////////////////////////////////////////////
                   
                    NoXml is string
                    i is int = 1
                   
                    LOOP
                       
                        NoXml = XMLExtractString(XML_Retorno,"NoXml",i)
                       
                        IF NoXml = "" THEN
                            BREAK
                        END
                       
                        DesFormaPagame is string = XMLExtractString(NoXml,"DesFormaPagame")
                        CodFormaPagame is string = XMLExtractString(NoXml,"CodFormaPagame")
                       
                        IF DebugSN = "S"
                            Info("Cartao",CodFormaPagame,DesFormaPagame)
                        END
                       
                       
                        //Busca Cartao
                        HReadSeekFirst(t004_cartoescreditos,t004_cartoescreditos.NomeCartao004,DesFormaPagame)
                       
                        IF HFound(t004_cartoescreditos) = False THEN
                           
                            //Adicionando a leitura do xml no banco de dados
                            t004_cartoescreditos.CodigoCartao004 = CodFormaPagame
                            IF t004_cartoescreditos.CodigoCartao004 = 0 THEN
                                Contador += 1
                                t004_cartoescreditos.CodigoCartao004 = Contador
                            END
                            t004_cartoescreditos.NomeCartao004 = DesFormaPagame
                            t004_cartoescreditos.DataAtualizacao004 = DateSys()
                           
                            IF DebugSN = "S" THEN
                                Info("tabela",t004_cartoescreditos.CodigoCartao004,t004_cartoescreditos.NomeCartao004)
                            END
                            //Arquiva resultado
                            ok = HAdd(t004_cartoescreditos)
                            IF ok = False THEN
                                //conta erros
                                erro += 1
                            ELSE
                                IF DebugSN = "S" THEN
                                    Info("Adicionado com sucesso")
                                END
                            END
                           
                        END
                        i++
                    END
                   
                ELSE IF InAndroidMode() = True
                    /////////////////////////////////////////////////////////////
                   
                    XmlDoc is xmlDocument
                   
                    XmlDoc = XMLOpen(XML_Retorno, fromString)
                   
                    NoXml is xmlNode
                   
                    //Leitura do xml em loop
                    FOR EACH NoXml OF XmlDoc.Xml.Recorte on NoXml
                       
                        IF DebugSN = "S"
                            Info("Cartao",NoXml.CodFormaPagame,NoXml.DesFormaPagame)
                        END
                        //Busca Cartao
                        HReadSeekFirst(t004_cartoescreditos,t004_cartoescreditos.NomeCartao004,NoXml.DesFormaPagame)
                       
                        IF HFound(t004_cartoescreditos) = False THEN
                           
                            //Adicionando a leitura do xml no banco de dados
                            t004_cartoescreditos.CodigoCartao004 = NoXml.CodFormaPagame
                            IF t004_cartoescreditos.CodigoCartao004 = 0 THEN
                                Contador += 1
                                t004_cartoescreditos.CodigoCartao004 = Contador
                            END
                            t004_cartoescreditos.NomeCartao004 = NoXml.DesFormaPagame
                            t004_cartoescreditos.DataAtualizacao004 = DateSys()
                           
                            IF DebugSN = "S" THEN
                                Info("tabela",t004_cartoescreditos.CodigoCartao004,t004_cartoescreditos.NomeCartao004)
                            END
                            //Arquiva resultado
                            ok = HAdd(t004_cartoescreditos)
                            IF ok = False THEN
                                //conta erros
                                erro += 1
                            ELSE
                                IF DebugSN = "S" THEN
                                    Info("Adicionado com sucesso")
                                END
                            END
                           
                        END
                    END
                   
                   
                END
               
                //Verifica quantos erros ocorreram se for maior que zero é falso o retorno
                IF erro > 0 THEN
                    ok = False
                ELSE
                    ok = True
                END
                //
               
            END
           
        END
       
    END //
   
END



// //LEITURA E GRAVACAO
// //=========================================================
// FOR EACH t004_cartoescreditos
// IF t004_cartoescreditos.CodigoCartao004 > 0 THEN
// Contador += 1
// END
// END
// IF Contador = 0 THEN
//
// t004_cartoescreditos.CodigoCartao004 = 1
// t004_cartoescreditos.NomeCartao004 = "VISA"
// t004_cartoescreditos.DataAtualizacao004 = DateSys()
// HAdd(t004_cartoescreditos)
//
// t004_cartoescreditos.CodigoCartao004 = 2
// t004_cartoescreditos.NomeCartao004 = "MASTER"
// t004_cartoescreditos.DataAtualizacao004 = DateSys()
// HAdd(t004_cartoescreditos)
//
// t004_cartoescreditos.CodigoCartao004 = 4
// t004_cartoescreditos.NomeCartao004 = "HIPERCARD"
// t004_cartoescreditos.DataAtualizacao004 = DateSys()
// HAdd(t004_cartoescreditos)
//
// t004_cartoescreditos.CodigoCartao004 = 5
// t004_cartoescreditos.NomeCartao004 = "AMERICAN"
// t004_cartoescreditos.DataAtualizacao004 = DateSys()
// HAdd(t004_cartoescreditos)
//
// t004_cartoescreditos.CodigoCartao004 = 6
// t004_cartoescreditos.NomeCartao004 = "SENFF"
// t004_cartoescreditos.DataAtualizacao004 = DateSys()
// HAdd(t004_cartoescreditos)
//
// t004_cartoescreditos.CodigoCartao004 = 7
// t004_cartoescreditos.NomeCartao004 = "ELO"
// t004_cartoescreditos.DataAtualizacao004 = DateSys()
// HAdd(t004_cartoescreditos)
// END

RESULT(ok)

------------------------------------------------------------------------------------------------------







Teste

Teste
teste