0% found this document useful (0 votes)
28 views3 pages

Códigos Clarion

The document defines screen controls, report controls and data fields for a queue called Fila_Diretorio. The queue contains fields for Name, Date, Time, Size and Attribute of directory entries. It also contains code to search a directory for files matching patterns, copy matching files to a target folder, create the target folder if needed, and display a progress indicator during the copy process.

Uploaded by

Joel Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Códigos Clarion

The document defines screen controls, report controls and data fields for a queue called Fila_Diretorio. The queue contains fields for Name, Date, Time, Size and Attribute of directory entries. It also contains code to search a directory for files matching patterns, copy matching files to a target folder, create the target folder if needed, and display a progress indicator during the copy process.

Uploaded by

Joel Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

[SCREENCONTROLS]

! PROMPT('Fila Diretorio:'),USE(?Fila_Diretorio:Prompt)
! ENTRY(@s26),USE(Fila_Diretorio)
[REPORTCONTROLS]
! STRING(@s26),USE(Fila_Diretorio)
Fila_Diretorio QUEUE,PRE(FDIR)
!!> IDENT(4294965863),PROMPT('Fila Diretorio:'),HEADER('Fila
Diretorio'),PICTURE(@s26)
[SCREENCONTROLS]
! PROMPT('Nome:'),USE(?FDIR:Nome:Prompt)
! ENTRY(@s13),USE(FDIR:Nome)
[REPORTCONTROLS]
! STRING(@s13),USE(FDIR:Nome)
Nome STRING(13)
!!> IDENT(4294965862),PROMPT('Nome:'),HEADER('Nome'),PICTURE(@s13)
[SCREENCONTROLS]
! PROMPT('Data:'),USE(?FDIR:Data:Prompt)
! ENTRY(@n-13),USE(FDIR:Data)
[REPORTCONTROLS]
! STRING(@n-13),USE(FDIR:Data)
Data LONG
!!> IDENT(4294965861),PROMPT('Data:'),HEADER('Data'),PICTURE(@n-13)
[SCREENCONTROLS]
! PROMPT('Hora:'),USE(?FDIR:Hora:Prompt)
! ENTRY(@n-13),USE(FDIR:Hora)
[REPORTCONTROLS]
! STRING(@n-13),USE(FDIR:Hora)
Hora LONG
!!> IDENT(4294965860),PROMPT('Hora:'),HEADER('Hora'),PICTURE(@n-13)
[SCREENCONTROLS]
! PROMPT('Tamanho:'),USE(?FDIR:Tamanho:Prompt)
! ENTRY(@n-13),USE(FDIR:Tamanho)
[REPORTCONTROLS]
! STRING(@n-13),USE(FDIR:Tamanho)
Tamanho LONG
!!> IDENT(4294965859),PROMPT('Tamanho:'),HEADER('Tamanho'),PICTURE(@n-13)
[SCREENCONTROLS]
! PROMPT('Atributo:'),USE(?FDIR:Atributo:Prompt)
! ENTRY(@n3),USE(FDIR:Atributo)
[REPORTCONTROLS]
! STRING(@n3),USE(FDIR:Atributo)
Atributo BYTE
!!> IDENT(4294965858),PROMPT('Atributo:'),HEADER('Atributo'),PICTURE(@n3)
END
!!> IDENT(4294965857)

AFTER GLOBAL INCLUDES


LPCSTR EQUATE(CSTRING)
Origem LPCSTR(255)
Destino LPCSTR(255)
Caminho LPCSTR(255)
INSIDE THE GLOBAL MAP
MODULE('CWRUN.H')
RenArq(*cstring,*cstring),short,raw,name('_rename')
DelArq(*cstring),short,raw,name('_remove')
VerArq(*cstring,short),short,raw,name('_access')
END

module('')
Access(*cstring,short),short,raw,name('_access')
ChMod(*cstring,short),short,raw,name('_chmod')
FRemove(*cstring),short,raw,name('_remove') !Renamed to avoid
conflict with Builtins.Clw
FRename(*cstring,*cstring),short,raw,name('_rename') !Renamed to avoid
conflict with Builtins.Clw
FnMerge(*cstring,*cstring,*cstring,*cstring,*cstring),raw,name('_fnmerge')

FnSplit(*cstring,*cstring,*cstring,*cstring,*cstring),short,raw,name('_fnsplit')
MkDir(*cstring),short,raw,name('_mkdir')
RmDir(*cstring),short,raw,name('_rmdir')
GetCurDir(short,*cstring),short,raw,name('_getcurdir')
ChDir(*cstring),short,raw,name('_chdir')
GetDisk(),short,name('_getdisk')
SetDisk(short),short,name('_setdisk')
CopyFileA(*LPCSTR,*LPCSTR,BOOL),BOOL,PASCAL,RAW
CopyLZFile(HFILE,HFILE),LONG,PASCAL
MoveFileA(*LPCSTR,*LPCSTR),BOOL,PASCAL,RAW
end

! VERIFICA SE ARQUIVO EXISTE


directory(Fila_Diretorio,'DSE6' & format(day(wdata),@n02) &
format(month(wdata),@n02) & '.' & format(CodCon,@n02),ff_:DIRECTORY)
if records(Fila_Diretorio) = 0
beep( BEEP:SystemExclamation )
message( 'Arquivo ' & Nome1 & ' n�o encontrado !', 'ERRO', ICON:Exclamation )
return
else
beep( BEEP:SystemExclamation )
message( 'Arquivo ' & Nome1 & ' localizado no Diret�rio !', 'ERRO',
ICON:Exclamation )
end

! APURA ARQUIVOS A SEREM COPIADOS


clear(Fila_Diretorio)
free(Fila_Diretorio)

directory(Fila_Diretorio,'*.TPS',ff_:DIRECTORY)
directory(Fila_Diretorio,'*.EXE',ff_:DIRECTORY)
directory(Fila_Diretorio,'*.DLL',ff_:DIRECTORY)
if records(Fila_Diretorio) = 0
setcursor
beep( BEEP:SystemExclamation )
message( 'Arquivos n�o encontrados !', 'ERRO', ICON:Exclamation )
return
end

?Progress1{Prop:Progress} = 0
?Progress1{Prop:RangeHigh} = records(Fila_Diretorio)

display

! CRIACAO DO DIRETORIO PARA COPIA


Diretorio = clip(Wcaminho)
Ret = ChDir(Diretorio)
if Ret <> 0 !! NAO EXISTE O DIRETORIO ESPECIFICADO
Ret = MkDir(Diretorio)
if Ret <> 0
setcursor
beep( BEEP:SystemExclamation )
message( 'N�o foi poss�vel criar a Pasta especificada !', 'ERRO',
ICON:Exclamation )
return
end
end
Diretorio = clip(WDiretorioSistema)
Ret = ChDir(Diretorio)

! COPIA DOS ARQUIVOS


loop i# = 1 to records(Fila_Diretorio)
get(Fila_Diretorio, i#)

Wmensagem = 'Copiando arquivo ' & clip(WDiretorioSistema) & clip(FDIR:Nome) &


' . . .'
display

Origem = clip(WDiretorioSistema) & clip(FDIR:Nome)


Destino = clip(Wcaminho) & '\' & clip(FDIR:Nome)
Ret = CopyFileA(Origem, Destino, 1)
if Ret <> 1
setcursor
beep( BEEP:SystemExclamation )
message( 'N�o foi poss�vel copiar o arquivo ' & clip(FDIR:Nome) & ' !|' &|
'Talvez o arquivo j� exista ou o disco esteja cheio.', 'ERRO',
ICON:Exclamation )
setcursor(Cursor:Wait)
end

Wmensagem = ''
?Progress1{Prop:Progress} = ?Progress1{Prop:Progress} + 1
display
end

You might also like