/* CONVERT_DESCRIPTION.CMD -- Convert FILES.BBS to 4OS2 description */
/*
* This is a REXX script that parses the contents of FILES.BBS and
* DESCRIPT.ION and sets the .SUBJECT extended attribute to the files's
* description for for each file found. This script is intended to be
* used when 4OS2 or Take Command for OS/2 is configured to use
* extended attributes for its descriptions. You can also see the
* description on the [File] page of a file's settings notebook in
* Workplace Shell, and several OS/2 utilities (such as NcFTP) give
* .SUBJECTs to the files that they create.
*
* (c) Copyright 1998 Jonathan de Boyne Pollard. All rights reserved.
*
* Permission is hereby granted for you to use, copy, modify, and redistribute
* this script to your heart's content, as long as you make no money from
* doing so, and as long as you realise that I accept no responsibility for
* whatever posession or use of this script may do to your machine, data,
* cat, or marital status.
*
* NOTE: This script requires Object REXX.
*/
call RxFuncAdd 'SysMkDir','RexxUtil','SysMkDir'
call RxFuncAdd 'SysFileTree','RexxUtil','SysFileTree'
call RxFuncAdd 'SysPutEA','RexxUtil','SysPutEA'
call RxFuncAdd 'SysGetMessage','RexxUtil','SysGetMessage'
if "" \= stream('FILES.BBS','c','query exists') then
call ParseFile 'FILES.BBS'
if "" \= stream('DESCRIPT.ION','c','query exists') then
call ParseFile 'DESCRIPT.ION'
if SysFileTree('*', 'dirs', 'SDO') == 0 then
do i = 1 to dirs.0
olddir = directory()
call directory dirs.i
if "" \= stream('FILES.BBS','c','query exists') then
call ParseFile 'FILES.BBS'
if "" \= stream('DESCRIPT.ION','c','query exists') then
call ParseFile 'DESCRIPT.ION'
call directory olddir
end
else
say Error reading the directory tree.
exit
ParseFile: procedure
parse arg DescriptionFileName
DescriptionFile = .stream~new(DescriptionFileName)
do while DescriptionFile~lines() \= 0
Line = DescriptionFile~linein()
select
when line == '' then nop
when line~left(1) == '-' then nop
when line~left(1) == '"' then do
parse var line '"'filename'"' description
call Describe filename description
end
otherwise do
parse var line filename description
call Describe filename description
end
end
end
error = DescriptionFile~close()
drop DescriptionFile
return
Describe: procedure
parse arg Filename Description
subject =
x2c("FDFF")||description~length()~d2c(2)~reverse()||description
error = SysPutEA(Filename, ".SUBJECT", subject)
if 0 \= error then
say SysGetMessage(error,,directory()||"\"||Filename),
' "'directory()'\'Filename'"'
/*address 'CMD' 'describe '||filename||' /D"'||description||'"'*/
return
/* ¯ JdeBP ® */
--- FleetStreet 1.22 NR
209/7211
103
* Origin: JdeBP's point, using Squish (2:257/609.3)
|