Jump to content
Fivewin Brasil

Rotina para gravar backup Google Drive - Resolvido


Jmsilva

Recommended Posts

 

Si, el problema es que en Harbour no es necesario definir el tipo de variable que se define en la function HB_JsonDecode, pero parece ser que en xHarbour si es necesario inicializar la variable

Prueba ahora

https://bitbucket.org/fivetech/fivewin-contributions/downloads/Googlex.lib

 

Linha 70: lSw  := oDrive:Activate()

 

Subsystem Call ....: BASE
System Code .......: 1123
Default Status ....: .F.
Description .......: Argument error
Operation .........: HHASKEY
Arguments .........:  [ 1] = Type: N Val:          1 [ 2] = Type: C Val: installed
Involved File .....: 
Dos Error Code ....: 0

 Trace Through:
----------------
HHASKEY               :       0 in Module: 
TGDRIVE:GETTOKENS     :     371 in Module: .\source\internal\TGOOGLE.PRG
TGDRIVE:ACTIVATE      :     226 in Module: .\source\internal\TGOOGLE.PRG
UPLOADMYFILE          :      70 in Module: gd.prg
MAIN                  :      37 in Module: gd.prg


############################## Video Screen Dump ##############################

 Error BASE/1123  Argument error: HHASKEY Arguments: ( [ 1] = Type: N Val:       
    1 [ 2] = Type: C Val: installed) (Quit)                                      
 Error BASE/1123  Argument error: HHASKEY Arguments: ( [ 1] = Type: N Val:       
    1 [ 2] = Type: C Val: installed)                                             
                                                                                 
 Error at ...: HHASKEY(0) in Module:                                             
 Called from : TGDRIVE:GETTOKENS(371) in Module: .\source\internal\TGOOGLE.PRG   
 Called from : TGDRIVE:ACTIVATE(226) in Module: .\source\internal\TGOOGLE.PRG    
 Called from : UPLOADMYFILE(70) in Module: gd.prg                                
 Called from : MAIN(37) in Module: gd.prg                                        
 

Link to comment
Share on other sites

Estou apenas compilando esse exemplo simples:

#include "Fivewin.ch"

REQUEST HB_CODEPAGE_PTISO
REQUEST HB_LANG_PT

//Para gerar as credencias pelo google vá ao site:
//https://cloud.google.com/?hl=pt-br
//1-Click sobre a palavra CONSOLE no canto superior direito
//2-Faz o login com seu_email@gmail.com
//3-Barra lateral esquerda, posicione sobre "Apis e Servicos" e
//  seleciona "Credenciais" no sub menu.
//4-Crie uma credencial para seu projeto
//5-faça donwload do arquivo .json
//copie o "Id do Cliente" em oDrive:cClientId
//copie a "Chave Secreta do Cliente" para oDrive:cSecretId

Static cKeySecret := "???????imdPvdApiQgbd3mwyAY"                                                  // chave oasys
Static cClientId  := "??????????????-??vbq15j2gm4kalevad82jqcpg4ma8kp.apps.googleusercontent.com"  // id oasys
Static oDrive

//----------------------------------------------------------------------------//
Function Main()
   HB_CDPSELECT("PTISO")
   //OU HB_SetCodePage("PTISO") // para ordenacion - requiere codepage.lib
   SET CENTURY ON

   UploadMyFile()
Return nil
//----------------------------------------------------------------------------//

Function UploadMyFile()
   local cFile  := ""
   local lSw    := .F.

   cFile := cGetFile32( "All Files (*.*) |*.*|", "Select a File to Upload" )
   MsgStop(cFile)
   if !Empty( cFile )
      oDrive  := TGDrive():New( , .T., .F. )
      //credenciais geradas pelo google
      oDrive:cJSonFile := "c:\fwh\samples\client_oasys.json"
      oDrive:cClientId := cClientId
      oDrive:cSecretid := cKeySecret

      //
      lSw     := oDrive:Activate()

      XBrowse(oDrive)

      if lSw
         if oDrive:Authorize()
            oDrive:ListFiles()  //carrega aFilesLists
            XBrowse( oDrive:aFilesLists )
            If oDrive:UpLoadFileG( cFile, , .T. )   // Last parameter .T., create shared link
               MsgInfo("Arquivo enviado com sucesso !!!","UpLoad")
            Else
               MsgStop(oDrive:cError,"UpLoad")
            Endif
         endif
      else
         MsgStop("Erro ao autenticar as credenciais do Google.","UpLoad")
      endif
   endif
Return nil

No Buildx.bat eu inclui essas linhas:

echo %fwh%\lib\googlex.lib %fwh%\lib\googlex.lib + >> b32.bc
echo %fwh%\lib\libeay32.lib %fwh%\lib\libeay32.lib + >> b32.bc
echo %fwh%\lib\libssl32.lib %fwh%\lib\libssl32.lib + >> b32.bc
echo %hdirl%\hbcurl.lib + >> b32.bc
echo %hdirl%\hbssl.lib + >> b32.bc
echo %hdirl%\tip.lib + >> b32.bc
echo %hdirl%\tipssl.lib + >> b32.bc

 

Link to comment
Share on other sites

Con este script he conseguido construir el exe de ejemplo de gmail sin problemas

Quote

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FiveWin for xHarbour 18.04 - May. 2018          xHarbour development power    ³Ü
ECHO ³ (c) FiveTech, 1993-2018   for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

ECHO Compiling...

set FWDIR=d:\fwh\fwhteam
rem set XHDIR=d:\xharbour\xharbour7
set XHDIR=D:\xharbour\xhb10234_bcc730
rem if "%2" == "/b" set GT=gtwin
rem if not "%2" == "/b" set GT=gtgui
set GT=gtgui

set hdir=%XHDIR%
set hdirl=%hdir%\lib
rem set bcdir=d:\borland\bcc7
set bcdir=d:\borland\bcc73
set fwh=%FWDIR%

%hdir%\bin\harbour %1 /n /i%fwh%\include;%hdir%\include /w /p %2 %3 > comp.log 2> warnings.log
IF ERRORLEVEL 1 GOTO COMPILEERRORS
@type comp.log
@type warnings.log

echo -O2 -e%1.exe -I%hdir%\include -I%bcdir%\include %1.c > b32.bc
%bcdir%\bin\bcc32 -M -c -v @b32.bc
:ENDCOMPILE

rem IF EXIST %1.rc %bcdir%\bin\brc32 -r -I%bcdir%\include %1
IF EXIST %1.rc %bcdir%\bin\brc32 -r -I%bcdir%\include -I%bcdir%\include\windows\sdk %1

echo %bcdir%\lib\c0w32.obj + > b32.bc
echo %1.obj, + >> b32.bc
echo %1.exe, + >> b32.bc
echo %1.map, + >> b32.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib %fwh%\lib\googlex.lib + >> b32.bc
echo %hdirl%\rtl.lib + >> b32.bc
echo %hdirl%\vm.lib + >> b32.bc
echo %hdirl%\%GT%.lib + >> b32.bc
echo %hdirl%\lang.lib + >> b32.bc
echo %hdirl%\codepage.lib + >> b32.bc
echo %hdirl%\macro.lib + >> b32.bc
echo %hdirl%\rdd.lib + >> b32.bc
echo %hdirl%\dbfntx.lib + >> b32.bc
echo %hdirl%\dbfcdx.lib + >> b32.bc
echo %hdirl%\dbffpt.lib + >> b32.bc
echo %hdirl%\hbsix.lib + >> b32.bc
echo %hdirl%\debug.lib + >> b32.bc
echo %hdirl%\common.lib + >> b32.bc
echo %hdirl%\pp.lib + >> b32.bc
echo %hdirl%\pcrepos.lib + >> b32.bc
echo %hdirl%\ct.lib + >> b32.bc
echo %hdirl%\zlib.lib + >> b32.bc
echo %hdirl%\hbzip.lib + >> b32.bc
echo %hdirl%\libmisc.lib + >> b32.bc
echo %hdirl%\tip.lib + >> b32.bc
echo %hdirl%\png.lib + >> b32.bc
echo %hdirl%\hbcc.lib + >> b32.bc
echo %hdirl%\hbcurl.lib + >> b32.bc
echo %fwh%\lib\libcurl.lib + >> b32.bc
rem echo %hdirl%\hbcurls.lib + >> b32.bc
echo %hdirl%\hbssl.lib + >> b32.bc
echo %hdirl%\tipssl.lib + >> b32.bc

rem Uso librerias que utilizaba con Harbour

echo d:\harbour\harbour7\lib\libeay32.lib + >> b32.bc
echo d:\harbour\harbour7\lib\libssl32.lib + >> b32.bc

echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
echo %bcdir%\lib\uuid.lib + >> b32.bc
echo %bcdir%\lib\ws2_32.lib + >> b32.bc
echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc
echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc
echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc
echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc
echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc
echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc

IF EXIST %1.res echo %1.res >> b32.bc

rem uncomment this line to use the debugger and comment the following one
if %GT% == gtwin %bcdir%\bin\ilink32 -Gn -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
if %GT% == gtgui %bcdir%\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
%1
GOTO EXIT
ECHO

rem delete temporary files
@del %1.c

:COMPILEERRORS
@type comp.log
ECHO * Compile errors *
GOTO EXIT

:LINKERROR
ECHO * Linking errors *
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Build [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT

Voy a probar el ejemplo de GDrive

Probado ejemplo de GDrive y funciona sin problemas

No son necesarias mas Librerias, pero me faltan hacer mas pruebas

 

 

Link to comment
Share on other sites

 

----------------------------------------- NEW VERSION 08/06/2018 --------------------

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=34903&start=45#p212840

 

----------------------------- xHarbour Error Log ------------------------------

Date...............: 09/06/2018
Time...............: 00:26:51

Application name...: C:\Users\Silva\Documents\Xailer\Projects\Gdrive.exe
Workstation name...: ASUS
Available memory...: 2097151
Current disk.......: C
Current directory..: Users\Silva\Documents\Xailer\Projects
Free disk space....: 391642374144

Operating system...: Windows 8 6.2.9200
xHarbour version...: xHarbour 1.2.3 Intl. (SimpLex) (Build 20180311)
xHarbour built on..: Mar 11 2018 14:25:00
C/C++ compiler.....: Borland/Embarcadero C++ 7.3 (32-bit)
Multi Threading....: NO
VM Optimization....: 1

Current Area ......:1

-------------------- Internal Error Handling Information  ---------------------

Subsystem Call ....: BASE
System Code .......: 1123
Default Status ....: .F.
Description .......: Argument error
Operation .........: HHASKEY
Arguments .........:  [ 1] = Type: N Val:          1 [ 2] = Type: C Val: installed
Involved File .....: 
Dos Error Code ....: 0

 Trace Through:
----------------
HHASKEY               :       0 in Module: 
TGDRIVE:GETTOKENS     :     371 in Module: .\source\internal\TGOOGLE.PRG
TGDRIVE:ACTIVATE      :     226 in Module: .\source\internal\TGOOGLE.PRG
UPLOADMYFILE          :      70 in Module: gd.prg
MAIN                  :      37 in Module: gd.prg


############################## Video Screen Dump ##############################

+--------------------------------------------------------------------------------+
|Error BASE/1123  Argument error: HHASKEY Arguments: ( [ 1] = Type: N Val:       |
|   1 [ 2] = Type: C Val: installed) (Quit)                                      |
|Error BASE/1123  Argument error: HHASKEY Arguments: ( [ 1] = Type: N Val:       |
|   1 [ 2] = Type: C Val: installed)                                             |
|                                                                                |
|Error at ...: HHASKEY(0) in Module:                                             |
|Called from : TGDRIVE:GETTOKENS(371) in Module: .\source\internal\TGOOGLE.PRG   |
|Called from : TGDRIVE:ACTIVATE(226) in Module: .\source\internal\TGOOGLE.PRG    |
|Called from : UPLOADMYFILE(70) in Module: gd.prg                                |
|Called from : MAIN(37) in Module: gd.prg                                        |
 

com uso dalib GOOGLEMX.LIBn apresenta:

Linking: Gdrive.exe...
Error: 'C:\USERS\SILVA\DOWNLOADS\GOOGLE (2)\GOOGLEMX.LIB' contains invalid OMF record, type 0x21 (possibly COFF)
0 Files, 0 Warnings, 1 Errors
Compile time: 0.00s   Link time: 0.38s   Total time: 0.38s
 

Link to comment
Share on other sites

  • 4 weeks later...


-HB32

Error occurred at: 07/07/2018, 19:44:02
Error description: Error BASE/1123  Argument error: HB_HHASKEY
Args:
  [   1] = N   1
  [   2] = C   installed

Application
===========
   Path and name: C:\Users\Silva\Documents\Xailer\Projects\Gdrive.exe (32 bits)
   Size: 3,956,224 bytes
   Compiler version: Harbour 3.2.0dev (r1603082110)
   FiveWin  version: FWH 17.05
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200 


Stack Calls
===========
   Called from:  => HB_HHASKEY( 0 )
   Called from: .\source\internal\TGOOGLE.PRG => TGDRIVE:GETTOKENS( 371 )
   Called from: .\source\internal\TGOOGLE.PRG => TGDRIVE:ACTIVATE( 224 )
   Called from: gd.prg => UPLOADMYFILE( 70 )
   Called from: gd.prg => MAIN( 37 )

   
-xHarbour
Error: 'C:\ROOT\GOOGLE\VERSAO_20180707\GOOGLE32.LIB' contains invalid OMF record, type 0x21 (possibly COFF)
 

Obrigado!

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...

Amiguinhos,

Eu tenho um jeito mais fácil de fazer este tipo de conexão.

Analise o seguinte How to de como configurar a conta para permitir a ligação.

Baixar Google Drive Conector e executar.

Entre no browser e comande ftp://127.0.0.1:1821/ coloque user como usuário e user como senha.

O resto corre normalmente. Pode configurar também o FileZilla, etc.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...