home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
pkbtm111.exe
/
PK.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-02-26
|
15KB
|
689 lines
@REM Pk.btm v1.11 (C) 1991,1992 FMMO Publications informatiques
@REM [Unregistered Shareware Evaluation Copy]
@REM Please make sure you distrubute this file as a single package with the
@REM following files: desclist.fmm
@REM fmmhost.bbs
@REM menudisp.fmm
@REM pkvar.lst
@REM pkbtm.doc
@REM magicn.fmo
@Echo off
if not "%cwd"=="" goto not4dos
if %_4ver LT 4.0 goto notv40
Loadbtm on
Setlocal
REM **************************************************************
REM Make sure you set the correct path !
Set /r c:\batch\pkbtm\pkvar.lst
REM **************************************************************
%keystackpath >& nul
setdos /M0
If "%1" ne "" goto fil_sel_by_cmdline
:pick
cls
screen 0 0 Working...
set pkfile=!
set isitadir=no
>%processfile
set currentpath=%_cwd
select /oe set isitadir=(*.*)
iff %isitadir==. then
goto pick
else
iff %isitadir==no then
gosub dispabort
%afterquit
quit
else
cd %isitadir >&> %processfile
endiff
iff %_? ne 0 then
echo Working...
type %processfile |eset pkfile >nul
keystack @83 @83 @83 @83 @83 @83 @83 @83 @83 @83 @83 @83 @83 @83 @79 8 13
eset pkfile >nul
goto outpick
endiff
goto pick
:fil_sel_by_cmdline
Set pkfile=%1
:outpick
If not "%@ext[%pkfile]"=="zip" gosub zipthis
Set pkfile=%@full[%@path[%pkfile]%@name[%pkfile].zip]
If "%flagforlogo"=="no" goto nologo
Text
Putting logo into file ...
Endtext
set error=%@exec[%pkzippath %@full[%pkfile] -z < %logofile]
If %error ne 0 goto decompressing_error
:nologo
If "%@descript[%@full[%pkfile]]"=="" Describe %@full[%pkfile] "%nodesc"
:redisplay
Cls
Gosub showtitle
Screen 6 0
Text
Current path is :
Current working file is :
Current file description is :
Endtext
Drawbox 4 0 10 77 1 blu on bla
Scrput 6 31 bri whi on bla %_cwd
Scrput 7 31 bri whi on bla %@full[%pkfile]
Scrput 8 31 bri whi on bla %@descript[%@full[%pkfile]]
if exist %downloaddirtry\*.* scrput 2 0 blink bri green on bla There is some files in %downloaddirtry
Gosub menu
Goto out
:menu
Screen 11 1 please select what you want to do |
Text
Unarchive current file to
Clear
Update description
Select another file
Unarchive to a specified directory
View current file (for ZIP only)
Scan file for viruses
Unarchive a specified file in this archive
Endtext
scrput 22 7 bri cyan on bla Simple file operations (submenu)
Scrput 14 33 bri yellow on bla %downloaddirtry
Scrput 15 13 bri yellow on bla %downloaddirtry
Drawbox 13 5 23 79 1 blue on bla
Set answer=%@substr[%@select[%menudisp,14,0,%@eval[%_rows-1],2],1,1]
Iff "%answer" ge "0" .and. "%answer" le "8" then
goto %@word[%answer,explode deldown describe select unzip view scanfile unarcspecified operations]
Else
Cls
Gosub dispabort
%afterquit
Quit
Endiff
:zipthis
if "%@ext[%pkfile]"=="lzh" goto lzhzip
if "%@ext[%pkfile]"=="arc" goto arczip
if "%@ext[%pkfile]"=="arj" goto arjzip
if "%@ext[%pkfile]"=="zoo" goto zoozip
Gosub redisplay
Return
:lzhzip
Gosub maketempdir
set processlzhfile=%@full[%pkfile]
cdd %tempdir
Gosub showtitle
text
endtext
if exist %lzhpath %lzhpath e %@full[%processlzhfile]
If %? ne 0 goto decompressing_error
Gosub filter
Gosub scanit
Del %@full[%processlzhfile]
%pkzippath %downloaddir\%@name[%pkfile].zip %tempdir\*.* -m
If %? ne 0 goto decompressing_error
Cdd %downloaddir
*Rd %tempdir
Return
:zoozip
Gosub maketempdir
set processzoofile=%@full[%pkfile]
cdd %tempdir
Gosub showtitle
text
endtext
if exist %zoopath %zoopath e %@full[%processzoofile]
If %? ne 0 goto decompressing_error
Gosub filter
Gosub scanit
Del %@full[%processzoofile]
%pkzippath %downloaddir\%@name[%pkfile].zip %tempdir\*.* -m
If %? ne 0 goto decompressing_error
Cdd %downloaddir
*Rd %tempdir
Return
:arjzip
gosub showtitle
Gosub maketempdir
set processarjfile=%@full[%pkfile]
Cdd %tempdir
Gosub showtitle
text
endtext
if exist %arjpath %arjpath e %@full[%processarjfile]
If %? ne 0 goto decompressing_error
Gosub filter
Gosub scanit
Del %@full[%processarjfile]
%pkzippath %downloaddir\%@name[%pkfile].zip %tempdir\*.* -m
If %? ne 0 goto decompressing_error
Cdd %downloaddir
*Rd %tempdir
Return
:arczip
Gosub maketempdir
set processarcfile=%@full[%pkfile]
Cdd %tempdir
Gosub showtitle
Text
Endtext
if exist %arcpath %arcpath %@full[%processarcfile]
If %? ne 0 goto decompressing_error
Gosub filter
Gosub scanit
Del %@full[%processarcfile]
%pkzippath %downloaddir\%@name[%pkfile].zip %tempdir\*.* -m
If %? ne 0 goto decompressing_error
Cdd %downloaddir
*Rd %tempdir
Return
Return
:unarcspecified
cls
Echo Working...
if exist e:\arcfmmo.lst del e:\arcfmmo.lst >nul
set error=%@exec[ %pkzippath -vc %@full[%pkfile] >> %arcfmmo ]
gosub showtitle
set pickazip=%@select[%arcfmmo,3,0,%@eval[%_ROWS-1],79,Pick a line which has a zip file on it !]
iff not "%pickazip"=="" then
cls
else
goto redisplay
endiff
set pksel=%@substr[%pickazip,60,12]
iff "%viewtolist"="on" then
cls
Text
Gathering selected information ...
Endtext
set error=%@exec[ %pkunzippath %@full[%pkfile] %pksel -c | %listpath /s]
If %error ne 0 goto decompressing_error
set viewtolist=off
goto operations
endiff
cls
gosub showtitle
Scrput 3 0 whi on bla The file wich you chosed to process is :
Scrput 3 41 cyan on bla %pksel
Screen 5 0
Inkey /K"yn" Do you want to extract it from %pkfile (y/n) ? %%answer
If not "%answer"=="y" goto redisplay
Text
Hope you know what you're doing...
Endtext
set error=%@exec[ %pkunzippath %@full[%pkfile] %pksel %downloaddirtry ]
If %error ne 0 goto decompressing_error
set error=%@exec[ %Scanpath %downloaddirtry\*.* %scanopt ]
If %error ne 0 goto dispinfected
Cdd %downloaddirtry
Echo This is the contents of %downloaddirtry
Dir %diropt %downloaddirtry
Pushd
Goto out
Endiff
:scanfile
Cls
Text
This will scan an archive but will not see trough it ...
Endtext
Echo Scanning %@full[%pkfile] for viruses ...
Text
Endtext
%Scanpath %@full[%pkfile] %scanopt
If %? ne 0 gosub dispinfected
goto redisplay
:dispinfected
Text
This archive seems to be infected with a virus
Watch Out! The original file is still in it's original form
Quitting...
Endtext
del %tempdir\*.* /y /q
cdd %downloaddir
*rd %tempdir
goto out
:select
Goto pick
:explode
Cls
set error=%@exec[ %Pkunzippath %@full[%pkfile] %downloaddirtry ]
If %error NE 0 goto decompressing_error
set error=%@exec[ %Scanpath %downloaddirtry\*.* %scanopt ]
If %error ne 0 goto dispinfected
Dir %diropt %downloaddirtry
popd *
cdd %downloaddirtry
Pushd %downloaddirtry
Goto out
:operations
Cls
Gosub showtitle
Scrput 12 5 bri cyan on bla -Press Escape to Go Back to Main Menu-
Screen 6 0
Text
current path is :
current working file is :
current file description is :
Endtext
Drawbox 4 0 10 77 1 blu on bla
Scrput 6 31 bri whi on bla %_cwd
Scrput 7 31 bri whi on bla %@full[%pkfile]
Scrput 8 31 bri whi on bla %@descript[%@full[%pkfile]]
Screen 11 1 please select what you want to do |
Text
Delete file
View file using e.g. Chris Buerg's List.com
Shell to command interpreter
Explode a selected file to the file viewer
Archive selected files in a file
Empty slot
Empty slot
Empty slot
Empty slot
Endtext
Drawbox 13 5 23 79 1 blue on bla
Set answer=%@substr[%@select[%menudisp,14,0,%@eval[%_rows-1],2],1,1]
Iff "%answer" ge "0" .and. "%answer" le "8" then
goto %@word[%answer,deletefile viewbuerg shellto4DOS viewflag archiveme emptyslot emptyslot emptyslot]
Else
Cls
Goto redisplay
Endiff
:archiveme
cls
gosub showtitle
screen 3 0
text
Intructions on how to use this function:
1st Navigate trough directories and select files by pressing enter, or select
multiple files by presing spacebar and enter. If you select directories,
the algorythm will automatically change you to the first directory selected.
2nd Press escape when you are done. Then you will be prompted for 2 things, if
you want to move those selected files in the archive, and after the name
of the archive.
Endtext
pause
cls
screen 0 0 Working...
>%dirlist
>%toziplst
:redisp
>%liste
select /oe echo (*.*) >> %liste
screen 0 0 Working...
text
endtext
if %@line[%liste,0] eq **eof** goto exit
set numoflin=%@eval[%@lines[%liste]-1]
set compte=-1
:loop
set compte=%@eval[%compte+1]
iff isdir %@line[%liste,%compte] then
echo %@line[%liste,%compte] >> %dirlist
else echo %@full[%@line[%liste,%compte]] >> %toziplst
endiff
iff not %compte GT %numoflin goto loop
if %@filesize[%dirlist] eq 0 goto redisp
iff %@line[%dirlist,0] eq . then
>%dirlist
goto redisp
else cd %@line[%dirlist,0]
>%dirlist
goto redisp
endiff
:exit
text
endtext
inkey /k"yn" Do you want to move the selected files in the archive (Y/N) ? : %%moveyn
text
endtext
input How will you name the archive ? : %%filename
if "%filename" eq "" goto operations
iff %moveyn eq y then
set moveyn=-m
else unset moveyn
endiff
set error=%@exec[ pkzip %moveyn %filename @%toziplst ]
unset moveyn
If %error ne 0 goto decompressing_error
goto operations
:viewflag
set viewtolist=on
goto unarcspecified
:deletefile
cls
Echo Deleting %@full[%pkfile] ..
Del %@full[%pkfile] >nul
goto select
:movefile
:copyfile
:edit file
:execute_file
:shellto4dos
set result=%@exec[%comspec]
goto operations
:viewbuerg
iff exist %listpath then
set result=%@exec[ %listpath %@full[%pkfile] ]
endiff
Goto operations
:emptyslot
cls
Text
This is an empty slot so you could put something of your own !
If you register, we will be glad to send you some usable code
to fill all those empty slots and more !
Just shell and go read pkbtm.doc
Endtext
REM Remember, the source is also available for a light supplement of 10$ :-))
Pause
Goto operations
:describe
Keystack "%@descript[%@full[%pkfile]]"
:reask
Scrput 3 0 bri red on bla Enter the new description. Press ESC and ENTER to be prompted for a choice !
Screen 9 30 └────────────────────────────────────────┘
Screen 8 31
Input %%newdes
Iff %@len[%newdes] gt 40 then
Keystack "%newdes"
Goto reask
Endiff
:descentered
Iff "%newdes" ne "" then
Describe %@full[%pkfile] ""
Echo %newdes | describe %@full[%pkfile] >nul
goto redisplay
Endiff
cls
set newdes=%@select[%descriptionlist,2,0,24,79,Please Select a Description Among These !]
If not "%newdes" ne "" set newdes=%nodesc
goto descentered
:deldown
Cls
Echo This is the content of %downloaddirtry
Text
Endtext
Dir %diropt %downloaddirtry
Text
Endtext
Inkey /K"yn" Do you want to delete the content of %downloaddirtry (y/n) : %%answer
Iff "%answer"=="y" then
Text
Deleting...
endtext
set result=%@exec[%deleteprotect_off >& nul ]
If exist %downloaddirtry\*.* del %downloaddirtry\*.* /y /q >& nul
set result=%@exec[%deleteprotect_on >& nul ]
Goto redisplay
Endiff
text
endtext
Inkey /K"yn" Do you want to move that somewhere ? (y/n) : %%answer
If "%answer"=="n" goto redisplay
Text
Endtext
Input Where do you want to move that (ENTER to quit): %%where
If "%where"=="" goto redisplay
Iff not isdir %where then
Text
You need to specify an existing directory !
I'll try to create it ...
Endtext
Goto makedir
Endiff
Echo Moving files to %where ...
*Move %downloaddirtry\*.* %where
Iff %_? NE 0 then
Text
An error as occured when moving files ..
Quitting...
Endtext
%afterquit
Cancel
Else
Goto redisplay
Endiff
:makedir
*Md %where >& nul
Set error=%_?
Text
Endtext
If "%error" != "0" goto imposs_dir
Echo The directory %where was succesfully created !
Echo Moving files to %where ...
Text
Endtext
*Move %downloaddirtry\*.* %where
Goto redisplay
:imposs_dir
Text
4DOS is not able to create this directory :-)
Please revise 4DOS.DOC !
Endtext
Pause
Goto redisplay
:view
Cls
Echo Gathering information on zip file...
Iff "%@ext[%@full[%pkfile]]"=="zip" then
set error=%@exec[ %pkzippath -vc %@full[%pkfile] | %listpath /s ]
else
Text
Not a zip archive ...
Endtext
pause
endiff
@goto redisplay
:unzip
Cls
Input Where do you want to unzip %pkfile : %%where
If "%where"=="" goto redisplay
If isdir %where goto dirok
*md %where >& nul
Set error=%_?
Text
Endtext
If %error != 0 goto imposs_dir
Text
Endtext
Echo The directory %where was succesfully created !
:dirok
Text
Endtext
Echo Unzippping files to %where ...
set error=%@exec[%Pkunzippath %@full[%pkfile] %where]
If %error NE 0 goto decompressing_error
%Scanpath %where /d %scanopt
If %? ne 0 goto dispinfected
Cdd %where
Cls
Echo This is the content of %where
Dir %diropt %where >&>nul
Pushd
Goto out
:upload
*Copy %@full[%pkfile] %uploaddir
Goto out
:acm
Cls
Text
Loading arcmaster....
Endtext
%arcmaster
Goto redisplay
:decompressing_error
Text
An error occured when processing this file.
Please fix the problem.
Endtext
%afterquit
Cancel
:dispabort
Text
[UNREGISTERED EVALUATION COPY]
Thanks for evaluating FMMO's software.
Have a nice 4DOS !
Endtext
Return
:scanit
%Scanpath %tempdir %scanopt
If %? ne 0 goto dispinfected
Return
:filter
If exist readmy.bbs del readmy.bbs
If exist readme.ros del readme.ros
If exist fmmobbs.doc del fmmobbs.doc
Return
:maketempdir
If not isdir %tempdir *md %tempdir
iff %_? ne 0 then
text
Fatal error
Could not create directory
endtext
goto out
endiff
Return
:showtitle
cls
Scrput 0 0 bri yellow on blu ≡ Pk.Btm v1.11 (C) 1991,1992 FMMO Publications Informatiques Enr. ≡
Drawhline 1 0 80 1 blu on bla
Return
:out
%afterquit
Popd >& nul
quit
:notv40
Echo Pk.btm is constantly updated to use the latest 4DOS functions.
Echo As of now, the most recent version of 4DOS is the 11-01-91 v4.0 release.
Echo Please read the file dl4dos.fmo for further information on
Echo how to obtain the most recent version of 4DOS.
quit
:not4dos
@echo
@echo 4DOS (tm) is not loaded on your system. This batch file only works with it.
@echo Feel free to download the latest version of 4DOS (tm) of JP Software from
@echo FMMHOST BBS in Sherbrooke, Qc. (819) 820-0590 ANSI,n,8,1 HST 14.4/v.32bis
@echo We are an official 4DOS Distribution Site !
@Echo 1:167/440@fidonet, 81-91-10@nanet, FMMO@DMI.USherb.ca@Internet