Jump to content
Fivewin Brasil

Edu

Membros
  • Posts

    126
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Edu

  1.  

    Obrigado Kapi! Mas eu já tenho a lib.

    Eu não consigo compilar. Erros:

    Executando: ILINK32 @B32.BC
    Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc.
    Error: Unresolved external '_curl_global_init_mem' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_global_cleanup' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_formfree' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_cleanup' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_reset' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_duphandle' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_init' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_hb_gcMark' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_hb_gcAllocate' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_pause' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_perform' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_send' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_recv' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_hb_storclen_buffer' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_formadd' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_slist_append' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_hb_parnldef' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_setopt' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_getinfo' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_slist_free_all' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_escape' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_unescape' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_version' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_version_info' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_easy_strerror' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_getdate' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_escape' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_unescape' referenced from LIB\HBCURL.LIB|core
    Error: Unresolved external '_curl_free' referenced from LIB\HBCURL.LIB|core

  2.  

    Vc altera, salva e depois roda o comando pra alterar a data do arquivo. função SetFDati()

     

    SetFDaTi()

    Sets the last change date and time of a file.

    Syntax

    
    SetFDaTi( <cFileName> , ;
             [<dFileDate>], ;
             [<cFileTime>]  ) --> lSuccess
    

    Arguments

    <cFileName>
    This is a character string holding the name of the file to set date and time for. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory only.
    <dFileDate>
    This is the date value to be set. It defaults to the return value of Date().
    <cFileTime>
    This is a time formatted string that defines the new file time. It defaults to Time().

    Return

    The function returns .T. (true) if the file date and time is set, otherwise .F. (false) is returned.

    Obrigado pela dica mas esta função não foi reconhecida no meu compilador. Existe algum include.ch que precisa ser importado no projeto?

  3. Boa tarde amigos!

     

    Criei uma rotina para alterar arquivos XML. A rotina está legal, mas a data de criação do arquivo está sendo alterada.

    Existe alguma forma de resolver isso, ou seja, alterar o arquivo sem mexer na data de criação do mesmo?

    Obs.: Estou usando as funções Memoread() e Memowrit().

  4. Boa tarde amigos!

    Consegui fazer funcionar esta pesquisa, se for de interesse de alguém...

    **************************************

    Function PesquisaNCM()


        * pesquisa NCM via API Cosmos : https://cosmos.bluesoft.com.br
        local oHttp, cUrl, aResult
        local cGTIN:= Space(13)
        
        MsgGet("Pesquisa NCM Cosmos", "Informe o código GTIN", @cGTIN)
        
        if Empty(cGTIN)
            return nil
        endif
            
        cUrl:= "https://api.cosmos.bluesoft.com.br/gtins/"+ cGTIN + ".json"
        
        oHttp:= CreateObject( 'MSXML2.ServerXMLHTTP.6.0' )
                                 
        oHttp:Open( "GET", cUrl, .f. )
       oHttp:setRequestHeader('Content-Type'  , 'application/json')             
       oHttp:setRequestHeader('X-Cosmos-Token', 'yIgeHB34Qv6RO18QWsftQw')             

        oHttp:Send()

        IF oHttp:status != 200
            MsgStop( Alltrim(Str(oHttp:status)) +" - "+ oHttp:statusText , "Erro na requisição")
            RETURN NIL
        ENDIF    

        x :=  hb_jsondecode( oHttp:ResponseBody, @aResult )

        xbrowse(aResult, "Resultado")
        
    return nil

  5. Bom dia!

    Uma alternativa é fazer um While até achar a ultima tag.

     

       oNode := oXmlDocument:FindFirst( "item" )
       DO WHILE oNode != NIL
          oNode := oXmlDocument:FindNext()
       ENDDO

       cConteudo:= oNode:cData  // obtem o conteudo da ultima tag encontrada

  6. Melhorias da função:

     

    FUNCTION SetPosXbr(Digitado, xPos, oLbx1)

        * Funcao de pesquisa sensitiva no xBrowse com Array
        LOCAL nPalavra:= UPPER(ALLTRIM(Digitado))    

        if Empty(wDigitado)
           oBrw:Gotop()
            Return .T.
        endif
        
        if LastKey() == 127 // se foi pressionado backspace
           oBrw:Skip(-1)
            Return .T.
        endif


        nPos := ASCAN(aPrinProd ,{|X| IF(nPalavra $ Substr(X[xPos], 1, LEN(nPalavra)) , .T. , .F. )})           
         
        IF nPos > 0 
           oLbx1:nArrayAt:= nPos
        ENDIF

       oLbx1:Refresh()

       oLbx1:Update()

    RETURN .T.

     

     

  7. Eu fiz uns testes com o MS Word e funcionou! Porém a janela que abre as sugestões perde o foco. Se alquém quiser contribuir...

    Segue o código.

     

    ********************************************************************************
    Function CorretorOrtografico()
        * Integração com corretor ortografico do MS Word
        
        Local cText:= SPACE(100)
        Local objWord, oDlg
        
        
        define dialog oDlg Resource "CORRETOR" TITLE "Corretor Ortográfico"
        
        redefine get oGet10 VAR cText ID 10 of oDlg UPDATE
        
        * verificar ortografia
        redefine button oBt20 ID 20 of oDlg ACTION( CheckSpelling(@cText), oGet10:Refresh() )
        
        * sair
        redefine button oBt21 ID 21 of oDlg ACTION oDlg:End()
        
        activate dialog oDlg Centered
        
    return nil

    ********************************************************************************    
    Function CheckSpelling(cText)    
            
        objWord:= CreateObject("Word.Application")
       
    //    objWord:Visible:= .f.
       
        * Cria um documento em branco
        objWord:Documents:Add()

        * Adiciona o texto no novo documento em branco
        objWord:Selection:TypeText(cText)

        * Aciona a ação de verificação ortográfica
        objWord:Documents:Item(objWord:Documents:Count):CheckSpelling()

        * Retorna o texto corrigido para o textbox
        cText := objWord:Documents:Item(objWord:Documents:Count):Content:Text

        * Fecha o documento sem salvar as alterações no documento em branco que foi criado
        objWord:Documents:Close(0)


        * Fecha a instância do word
        objWord:Quit()

        * Destrói o objeto word
        objWord := Nil
        
    return nil

×
×
  • Create New...