home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
opus
/
v5
/
datestamp
/
datestamp1.dopus5
< prev
Wrap
Text File
|
1977-12-31
|
4KB
|
140 lines
/*
Short: A DateStamp that won't stop for DOpus5.5+ (In theory)
Uploader: Dave Clarke <4wd@connexus.apana.org.au>
Author: Dave Clarke <4wd@connexus.apana.org.au>
Type: biz/dopus/
$VER: DateStamp.dopus5 1.2 (14.8.96)
This ARexx module will, in theory, DateStamp files, avoiding those that are
'locked' without stopping and bringing up a requester.
I stress 'In Theory', because I didn't have any way to 'lock' a file and
couldn't test it :) But it did work on my system _without_ any locked files!
(And someone has just told me it works on their system _with_ locked files :)
Installation:
Copy it into your DOpus5:Modules directory, this will add the command
'DateStamp1' to the internal command set.
Then create a button, menuitem, etc, as follows:
Function Command DateStamp1 [VIEW/K]
The VIEW keyword specifies that the result file will be shown at the end.
There _must_ be a source lister present, and you can just select files and
directories.
History:
V1.0 - It exists, therefore it is. Only works for files at the moment.
V1.1 - Now handles files in directories, but doesn't actually datestamp the
directory :)
V1.2 - Now datestamps the directories. Put the VIEW keyword back.
NOTE: Doesn't check to see if the directory is locked.
*/
parse arg portname function source dest arguments
address value portname
options results
if function = 'init' then do
dopus command "DateStamp1" program "DateStamp1" desc "'Set the date for files/dirs'" template "VIEW/K" 'source'
exit
end
parse upper var arguments view
if view = 'VIEW' then view_flag = 1
lister query source path
path = strip(result,B,'"')
if left(path,8) = 'Ram Disk' then do
parse upper var path ':' subdirs
path = 'RAM:'subdirs
end
FixPath(path)
oldpath = pragma('d',path)
lister query source selfiles stem files.
lister query source seldirs stem dirs.
if files.count = 0 | files.count = '' | files.count = 'FILES.COUNT' then nofile = 1
if dirs.count = 0 | dirs.count = '' | dirs.count = 'DIRS.COUNT' then nodirs = 1
if nofile = 1 & nodirs = 1 then call ERROR 'Nothing selected!'
tdate = date('E')
ntime = time('N')
newtime = translate(tdate,'-','/')||" "||ntime
dopus getstring '"Input date to stamp files with:" 20 "'newtime'" Okay|Cancel'
newtime = result
if newtime = '' | newtime = 'RESULT' then exit
call open('outfile','T:Date.results','W')
i = 0
do while i < files.count
lister select source files.i off
lister refresh source full
if ~open('FILE',files.i,'R') then
call writeln('outfile',files.i)
else
call close('FILE')
address command 'SetDate 'files.i newtime
i = i + 1
end
path = pragma('d',oldpath)
FixPath(path)
i = 0
do while i < dirs.count
lister select source dirs.i off
lister refresh source full
address command 'SetDate 'path||dirs.i'/ 'newtime
address command 'list 'path||dirs.i' all files lformat "%p%n" >T:DS.temp'
address command 'list 'path||dirs.i' all dirs lformat "%p%n %l" >>T:DS.temp'
if open('infile','T:DS.temp','r') then
do
do while ~eof('infile')
thefile = readln('infile')
if word(thefile,2) ~= 'Dir' then
if ~open('FILE',thefile,'R') then
call writeln('outfile',thefile)
else do
call close('FILE')
address command 'SetDate 'thefile newtime
end
else do
thedir = word(thefile,1)
FixPath(thedir)
address command 'SetDate 'thedir newtime
end
end
call close('infile')
call delete('T:DS.temp')
end
i = i + 1
end
call close('outfile')
if view_flag = 1 then
'dopus read delete T:Date.results'
else
call delete('T:Date.results')
exit
FixPath:
tpath = arg(1)
if index(tpath,':') = 0 then tpath = tpath':'
else if (right(tpath,1) ~= '/') & (right(tpath,1) ~= ':') then tpath = tpath'/'
return tpath
ERROR:
parse arg error
dopus request "'"error"'" "OK"
exit