terça-feira, 8 de setembro de 2015

Monitorando Arquivo Numa Pasta / Timer / Arquivo







VIDEO SOBRE MONITORAR ARQUIVO NUMA PASTA - TIMER - ARQUIVO






Tenho um programa em clarion, em que o cliente, tem uma segunda tela.
enquanto esta sendo fechado a conta do cliente, precisava aparecer
na outra tela, somente algumas informacoes.
entao fiz em windev que monitora um arquivo texto que criei.
usei o timer
















PROCEDURE timer_fechamento()
//GLOBAL - Clicar no inicio do programa,projeto,code
//    gdAta_arquivo is date
//    gtHora_arquivo is time
//   
   
_data is Date = fDate("ENCERRA_100.TXT")
_hora is Time = fTime("ENCERRA_100.TXT")
IF _data=gdAta_arquivo AND _hora=gtHora_arquivo THEN
ELSE
    gdAta_arquivo=_data
    gtHora_arquivo=_hora
    //trace(_hora)
    nArquivoid is int
    nArquivoid = fOpen("ENCERRA_100.TXT",foReadWrite)
    TableDeleteAll(TABLE_CONSUMO)
    _CODIGO is int
    _QUANTIDADE is currency
    _TOTAL is currency
    _NOME is string
    IF nArquivoid<>-1 THEN
        sLinha is string
        sFimarquivo is string
        sPegacampo is string
        LOOP
            sLinha = fReadLine(nArquivoid)
            IF sLinha = EOT THEN
                BREAK
            ELSE           
                IF sLinha="" THEN
                    BREAK
                ELSE
                    sPegacampo = ExtractString(sLinha,firstRank,"|")
                    sFimarquivo= ExtractString(sLinha,nextRank,"|")
                    IF sFimarquivo="FIM" THEN
                        BREAK
                    ELSE
                        IF sFimarquivo="RESUMO" THEN
                            EDT_Numero_encerramento=ExtractString(sLinha,nextRank,"|")
                            EDT_hospedagem=ExtractString(sLinha,nextRank,"|")
                            EDT_apartamento=ExtractString(sLinha,nextRank,"|")
                            EDT_VEICULO=ExtractString(sLinha,nextRank,"|")
                            EDT_VEICULO=EDT_VEICULO + " " +ExtractString(sLinha,nextRank,"|")
                            EDT_VEICULO=EDT_VEICULO + " " +ExtractString(sLinha,nextRank,"|")
                            EDT_OBSERVACAO=ExtractString(sLinha,nextRank,"|")
                            EDT_OBSERVACAO=EDT_OBSERVACAO + " " +ExtractString(sLinha,nextRank,"|")
                            EDT_HORA_ENTRADA=ExtractString(sLinha,nextRank,"|")
                            EDT_HORA_SAIDA=ExtractString(sLinha,nextRank,"|")
                            EDT_TEMPO=ExtractString(sLinha,nextRank,"|")
                            EDT_Numero_Pessoas=ExtractString(sLinha,nextRank,"|")
                            EDT_horas_extras=ExtractString(sLinha,nextRank,"|")
                            EDT_dias_pernoite=ExtractString(sLinha,nextRank,"|")
                            EDT_data_Entrada=ExtractString(sLinha,nextRank,"|")
                            EDT_data_SAIDA=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_CONSUMO=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_eSTADIA=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_EXTRA=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_PERNOITE=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_ESTADIA_1=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_DESCONTO=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_PAGAR=ExtractString(sLinha,nextRank,"|")
                            EDT_TOTAL_TROCO=ExtractString(sLinha,nextRank,"|")
                        ELSE   
                           
                            IF sFimarquivo="ITENS" THEN
                                _CODIGO=ExtractString(sLinha,nextRank,"|")
                                _QUANTIDADE=ExtractString(sLinha,nextRank,"|")
                                _TOTAL=ExtractString(sLinha,nextRank,"|")
                                _NOME=ExtractString(sLinha,nextRank,"|")
                               
                                TableAddLine(TABLE_CONSUMO,_CODIGO,_NOME,_QUANTIDADE,_TOTAL)
                            END               
                        END               
                    END              
                END
            END
        END   
    END
    TableDisplay(TABLE_CONSUMO)
    nArquivoid = fClose(nArquivoid)
END






Windev Mobile - 29/... Pdf - Ler Pdf direto do Aparelho Android













Nessa aula, vou mostrar como eu fiz para achar uma solucao para ler um pdf, direto
no aparelho do android.
Posso usar simplesmente Shellexecute("Arquivo Pdf ")
ou
fazer como esse exemplo . que abre o pdf direto no aparelho.

Nesse outro blog, finalizo essa questao pois tinha me esquecido de acrescentar o zip
que foi mandando no exemplo
Blog Windev-mobile-30-pdf-ler-pdf-direto-do.html

http://repository.windev.com/
http://repository.windev.com/resource.awp?file_id=244;android-lecteur-pdf-autonome-dans-champ-html-url-fichiers-locaux

Video - Windev Mobile - 29/... Pdf - Ler Pdf direto do Aparelho Android





















//Botao do Pdf

strMonpdf est une chaîne ="http://www.matosinformatica.com.br/listaserv.pdf"
mostra_pdf("HTML1",strMonpdf)


// Java - activerjavascript

import android.webkit.WebView;
public static void activerjavascript(String nomchamp)
{
    WebView mywebview=(WebView) getView(nomchamp);
    mywebview.getSettings().setJavaScriptEnabled(true);
}


PROCEDURE mostra_pdf(s_nome_html is string,sNome_pdf is string)
modeSVG is boolean=True
fDelete(CompleteDir(fRepExe())+"TMPPDF_*.pdf") //fSupprime(ComplèteRep(fRepExe())+"TMPPDF_*.pdf")
nomfic is string="TMPPDF_"+DateSys()+HeureSys()+sNome_pdf+".pdf"
tmpPDf is string=CompleteDir(fRepExe())+""+nomfic // est une chaîne
SI EnModeAndroid()  ET PAS EnModeTest ALORS
    //est-ce que les ressources de gestion pdf sont bien présentes ?
    SI PAS fFichierExiste(ComplèteRep(fRepExe())+"viewersvg.html") OU PAS fFichierExiste(ComplèteRep(fRepExe())+"viewersvg.js") ALORS
        fExtraitRessource("WD_pdfjs2.zip",fRepExe())
        SI fFichierExiste(ComplèteRep(fRepExe())+"WD_pdfjs2.zip") ALORS
            //decompactage de la ressource
            myarch est un entier=zipOuvre("archpdf",ComplèteRep(fRepExe())+"WD_pdfjs2.zip")
            SI myarch=0 ALORS
                zipExtraitTout("archpdf",ComplèteRep(fRepExe()))
                zipFerme("archpdf")
            FIN
        FIN
    FIN
    SI PAS fFichierExiste(ComplèteRep(fRepExe())+"viewersvg.html") OU PAS fFichierExiste(ComplèteRep(fRepExe())+"viewersvg.js") ALORS
        //aucun display possible, les ressources sont absentes.
        //retour      
    FIN
    activerjavascript(s_nome_html)
FIN
SI Gauche(sNome_pdf,4)="http" ALORS
    //1 recuperer le fichier en local avant ouverture
    SI HTTPRequête(sNome_pdf) ALORS
        fSauveTexte(tmpPDf,HTTPDonneRésultat(httpRésultat))
    FIN
SINON
    fCopieFichier(sNome_pdf,tmpPDf)
FIN

bLocalDebug est un booléen=Vrai
SI EnModeTest() ALORS
    //{nomchamp,indchamp}=strMonpdf
    //test avec localhost
    //    si localDebug alors
    //        fCopieFichier(ComplèteRep(fRepExe())+"web\viewersvg.html","c:\wamp\www\pdfjstest\web\viewersvg.html")   
    //        fCopieFichier(ComplèteRep(fRepExe())+"web\viewersvg.js","c:\wamp\www\pdfjstest\web\viewersvg.js")   
    //        nomfic est une chaine="test.pdf"+datesys+heuresys
    //       
    //        fCopieFichier(tmpPDf,"c:\wamp\www\pdfjstest\web\"+nomfic)
    //       
    //        testurl est une chaine="http://localhost/pdfjstest/"+"web/viewersvg.html?url="+"./"+nomfic+"&ti="+datesys+heuresys
    //        //{nomchamp,indChamp}=testurl
    //        LanceAppliAssociée(testurl)
    {s_nome_html,indChamp}=sNome_pdf
SINON
   
    myurl est une chaîne
    SI modeSVG ALORS
        myurl="file://"+ComplèteRep(fRepExe)+"viewersvg.html?url="+"./"+nomfic+"&ti="+DateSys+HeureSys
    SINON
        myurl="file://"+ComplèteRep(fRepExe)+"viewer.html?url="+"./"+nomfic+"&ti="+DateSys+HeureSys
    FIN
   
    {s_nome_html,indChamp}=myurl
FIN



Blog - Windev Mobile - Instalaca - Android 1/...
Blog - Windev Mobile - Instalacao - Java 2/...
Blog - windev Mobile - MyExplorer 3/...
Blog - Windev Mobile - Android - Configurar Ansi 5/...
Blog - Windev Mobile - Layout - 6/.... 
Blog - Windev Mobile - Target_Code - 8/...
Blog - Windev Mobile - Agenda Cadastrar - 9/...
Blog - Windev Mobile - Agenda Mostrar - 10/...
Blog - Windev Mobile - Agenda Alterar - 11/...
Blog - Windev Mobile - Agenda Excluir - 12/...
Blog - Windev Mobile - HyperFile Error - 13/...
Blog - Windev Mobile -Tirar Foto - 14/... 
Blog - Windev Mobile - Pegar Foto Album - 15/...
Blog - Windev Mobile - hyperfil server - Acessar Rede/Could - Parte - 16/...
Blog - Windev Mobile - Query - Criar Consulta - Looper - Parte 17/...
Blog - Windev Mobile - Query - Tabela - Parte 18/...
Blog - Windev Mobile - Query - Filtro Acrescentar - Parte 19/...
Blog - Windev Mobile - Email - Parte 20/...
Blog - Windev Mobile - Analise Bolo Receita a/.. - Parte 21/...
Blog - Windev Mobile - Analise Bolo Receita b/... - Parte 22/...
Blog - Windev Mobile - Receita Bolo c/.. - Menu/Layout - Parte 23/...
Blog - Windev Mobile - Receita Bolo d/.. - Categoria - Parte 24/...
Blog - Widnev Mobile - Receita bolo e/.. - Categoria Altera/Exclui - Parte 25/...
Blog - Windev Mobile - 26/... - Receita Bolo - Combox Categoria
Blog - Windev Mobile - 27/.. - Receita Bolo - Tabela Bolo
Blog - Windev Mobile - 28/... - Xml - Retirar Conteudo Blog - Funcao
Blog - Windev Mobile - 29/... - Pdf - Ler Pdf Direto do Aparelho Android 
Blog - Windev Mobile - 30/... - Pdf - Ler Pdf Direto do Aparelho Android - Final 
Blog - Windev Mobile - 31/... - Looper - Criar Manual e Selecionar Informação
Blog - Windev Mobile - 33/.. Xml - Ler turmas e Mostrar Looper  
Blog - Windev Mobile - 35/... - Looper Mostrar Todos Dados Alunos  
Blog - Windev Mobile - 36/... - Looper Turma Mostra direto Alunos 
Blog - Windev Mobile - 37/... - Looper - Pegando Pelo WebService  
Blog - Windev Mobile - 38/... - Windows  - Mudar o Nome doTitulo 
Blog - Windev Mobile - 39/... - Xml - Ler Posicao Inicial/Final - turmar Alunos  
Blog - Windev Mobile - 40/... - Xml - Ler Posicao Inicial/final/Especialidade/Refeito Funcao  

FFileExist



FFileExist

http://doc.windev.com/en-US/?3036015&name=ffileexist_function


xml_arquivo is string = "c:\importa\964-env-loterps-ret.xml"
CONTADOR is int
FOR CONTADOR =1 TO 100000
    STC_aguarde_1="Aguarde..."+xml_arquivo+" .."+CONTADOR
    IF fFileExist(xml_arquivo) THEN
        STC_aguarde_1="Achou o Arquivo"
        BREAK
    ELSE
   
    END
END

Teste

Teste
teste