home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
jambtm02.exe
/
MAKEDESC.BTM
< prev
next >
Wrap
Text File
|
1992-11-15
|
4KB
|
135 lines
*REM This batch file is Freeware, free to use and redistribute unmodified *
*REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
REM Create a _DESC.BTM file (when it is run it'll create descriptions)
REM Note: 4desc 1.2 is great utility written by David Frey and Tom Bowden.
REM Timestamp: 08-Nov-1992
setlocal^break on^unalias *^set arg=/a-d^if "%1"=="-?" goto info
REM Might be better to use.. (below) ..to avoid some trouble faced later.
REM set arg=for /a-d
REM Note: "describe" command cannot describe hidden or system files.
REM Most annoying feature, _if_ you need to do it anyway. 4DOS 4.01 rev D.
alias my_desc=`iff "%@attrib[%1,h]"=="1" then^set h=1^attrib/q -h %1^endiff^iff "%@attrib[%1,s]"=="1" then^set s=1^attrib/q -s %1^endiff^describe %1 %2&^if "%h"=="1" attrib/q +h %1^if "%s"=="1" attrib/q +s %1^unset/q s h`
REM Did the user give any arguments?
if "%@ascii[%1]" != "45" goto no_desc
:optiot
set index=%@eval[%index+1]^set %@ascii[%@substr[%1,%index,1]]=1
if %index lt %@eval[%@len[%1]-1] goto optiot^shift
REM Note: order of options should not matter, but it does.. place goto's last.
iff "%[%@ascii[d]]"=="1" then^set dirs=1^set arg=/a^endiff
iff "%[%@ascii[e]]"=="1" then^set edit=1^endiff
iff "%[%@ascii[i]]"=="1" then^set ignore=1^endiff
iff "%[%@ascii[?]]"=="1" then^goto info^endiff
iff "%[%@ascii[a]]"=="1" then^set auto=1^goto make^endiff
REM if no descript.ion file or you want to edit descriptions
:no_desc
iff not exist descript.ion .or. "%[edit]"=="1" then
iff not exist descript.ion then
inkey No descript.ion file !?! Do you want to create one? %%c
if "%c"=="n" .or. "%c"=="N" .or. "%@ascii[%c]"=="27" goto end
endiff
iff "%@search[4desc]" != "" then
4desc
else
for%[arg] %%x in (*.*) gosub add_desc
endiff
set ignore=1
endiff
if not exist descript.ion goto no_desc
:make
REM create a new _DESC.BTM file
del/qz _desc.btm >& nul
echo @echo off >> _desc.btm
echo n: descriptions for files in Volume %@label[.] %_cwds on %_daten >> _desc.btm
my_desc _desc.btm "give a description to some files"
my_desc descript.ion "description file"
if "%auto"=="1" goto auto
REM fill the new _DESC.BTM file
REM Note: don't forget to leave space in between of "for" and "arguments"!
for%[arg] %%x in (*.*) gosub entry^goto end
REM add a new entry into _DESC.BTM
:entry
iff "%@descript[%x]"=="" then
iff "%[ignore]"=="1" then
return
else
inkey %x is missing description! Do you want to add it? %%c
if "%c"=="n" .or. "%c"=="N" .or. "%@ascii[%c]"=="27" return
iff "%@search[4desc]" != "" then
4desc
else
my_desc %x
endiff
endiff
endiff
echos describe %xt >> _desc.btm
if %@len[%x] lt 7 echos `t` >> _desc.btm
echos " >> _desc.btm
echos %@descript[%x] >> _desc.btm
echo " >> _desc.btm
return
REM trouble with for command, had to make add_desc as a subroutine...
REM Note: if need to give options to command, use command in some variable, too
REM Note: to preserve %a from too early expansion, use %%a, not control-x%
REM 4DOS 4.01 rev D
:add_desc
iff "%[ignore]"=="1" then
if "%@describe[%x]" != "" my_desc %x
else
my_desc %x
endiff
return
REM Automatic _DESC.BTM file creation from DESCRIPT.ION file. No questions.
:auto
iff exist descript.ion then
for %a in (@descript.ion) (
set name=%@word[0,%a]
echos describe %name >> _desc.btm
if %@len[%name] lt 7 echos `t` >> _desc.btm
echo t"%@substr[%a,%@eval[%@len[%name]+1]]" >> _desc.btm
)
endiff^goto end
:info
echo Usage: %@lower[%@name[%0]] [-options]
text
-a automatic creation from descript.ion file
-d directories included
-e edit descriptions beforehand
-i ignore missing descriptions
-? this info
Creates a _DESC.BTM file to describe files in current directory.
Note: There _cannot_ be any commas, DOS redirection characters, percents
or quotes in descript.ion file! Use _echoable_ descriptions.
endtext
:end
if "%@filesize[_desc.btm]"=="0" del/qz _desc.btm >& nul
break off^quit