home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boldly Go Collection
/
version40.iso
/
TS
/
12B
/
PKBTM120.ZIP
/
PK.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-04-24
|
21KB
|
1,348 lines
@rem ┌─────────────────────────────────────────────────────────────────────────┐
@rem │ 4 4 DDD OO SSS 4 4 00 │
@rem │ PKBTM Version 1.20 for 4 4 D D O O S 4 4 0 o0 │
@rem │ 4444 D D O O SSSS 4444 0o 0 │
@rem │ (C) 1992 FMMO Publications 4 D D O O S 4 0 0 │
@rem │ Informatiques Enr. 4 DDD OO SSS 4 . 00 │
@rem │ │
@rem │ [Non-Registered Version] 04-24-92 │
@rem ├─────────────────────────────────────────────────────────────────────────┤
@rem │4DOS is a trademark of JP Software P.O. Box 1470 East Arlington, MA 02174│
@rem └─────────────────────────────────────────────────────────────────────────┘
@ECHO off
if not "%cwd"=="" goto not4DOS
REM MS-DOS Compatibility stops from here !
if %_4ver LT 4.0 goto not_4DOSv40
REM 4DOS v3.03 and lower Compatibility stops from here !
REM This is really where PKBTM starts
Cls
Scrput 0 0 whi on bla Working ...
REM PKBTM needs to be in overstrike mode.
Setdos /m0
Loadbtm on
Setlocal
Set total_env=%_ENV
REM The following line should be replaced by the real path of your PK.INI
REM file for faster operation. Here's an example :
REM Set /r d:\pathname\pk.ini >& nul
REM The way this is programmed, it will use the @search command to look for
REM PK.INI in all the directories specified by your path. If PKBTM cannot
REM find it, it will let you know and exit to 4DOS.
Set /r %@search[pk.ini] >& nul
REM The following line instructs 4DOS to redirect the errorlevel to a file.
REM This is the only method we found to make 4DOS distinguish the file not
REM found error from the Not Enough Environment error.
ECHO %_? >error
iff %@line[error,0] eq 2 then
del error >& nul
echo Not enough environment or alias space :-(
echo.
beep 310 10
beep 210 10
echo You would have only %_ENV bytes of free environment.
text
This is not enough to run PKBTM.
Solution : a) run PKBTM under a 4DOS /e=4096 shell.
b) look in the main screen how much bytes of environment
PKBTM needs.
c) Add this amount to your 4DOS.INI file
d) Refer to 4DOS.DOC for more information on environment memory.
Endtext
endlocal
cancel
endiff
iff not "%configured"=="yes" then
del error >& nul
Echo Cannot run PKBTM :-(
beep 310 10
beep 210 10
set error=%@search[PK.INI] >& nul
iff "%error" ne "" then
text
PK.INI is not properly configured to fit your system.
Solution : a) Read PKBTM.DOC.
It is crucial for the well behavior of this BTM file that
the variables in PK.INI be configured to fit your
system. If strange stuff keeps happening, the error is most
probably in the configuration of this file's variables.
endtext
else
text
PK.INI is not in your path or its path is not specified in PKVAR.LST.
Solution : a) Move all PKBTM files in a directory that is included
in your path statement.
b) Edit the PKBTM file and change the %@search command,
so it would point to the path of PK.INI.
c) Read 4DOS.DOC for more information on the path
statement
Endtext
endiff
endlocal
cancel
endiff
del error >& nul
%keystackpath >& nul
%cursor_off
break off
pushd
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
cdd %isitadir >&> %processfile
endiff
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 %boxstyle blu on bla
Scrput 5 79 bri green on bla E
VScrput 7 79 bri whi on bla %@eval[%total_env - %_ENV]
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 files in archive 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 %boxstyle blue on bla
Set answer=%@substr[%@select[%@search[%menusel],14,0,%@eval[%_rows-1],2],1,1]
Iff "%answer" ge "0" .and. "%answer" le "8" then
goto %@word[%answer,explode deldown describe pick unzip view scanarchive 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
Screen 2 0
text
endtext
if exist %@search[%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
Screen 2 0
text
endtext
if exist %@search[%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
Screen 2 0
text
endtext
if exist %@search[%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 %@search[%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
: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]
if "%pksel"="" goto redisplay
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
beep
Scrput 3 0 whi on bla The file wich you chosed to process is :
Scrput 3 41 cyan on bla %pksel
Screen 5 0
%cursor_on
Inkey /K"yn" Do you want to extract it from %pkfile (y/n) ? %%answer
%cursor_off
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
:scanfile
Cls
Text
This will scan all files in an archive for viruses ...
Endtext
Echo Scanning %@full[%pkfile] for viruses ...
Text
Endtext
%Scanpath %@full[%pkfile] %scanopt
If %? ne 0 gosub dispinfected
goto redisplay
: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 %boxstyle 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
Scan file for viruses
Empty slot
Empty slot
Empty slot
Endtext
Drawbox 13 5 23 79 %boxstyle blue on bla
Set answer=%@substr[%@select[%@search[%menusel],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 scanfile 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
if not %compte GT %numoflin goto loop
if %@filesize[%dirlist] eq 0 goto redisp
iff %@line[%dirlist,0] eq . then
>%dirlist
goto redisp
else
cdd %@line[%dirlist,0]
>%dirlist
goto redisp
endiff
:exit
text
endtext
%cursor_on
inkey /k"yn" Do you want to move the selected files in the archive (Y/N) ? : %%moveyn
%cursor_off
text
endtext
%cursor_on
input How will you name the archive ? : %%filename
%cursor_off
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 pick
:scanarchive
Cls
Echo Unarchiving files in archive %@full[%pkfile] for viruses ...
set error=%@exec[ %pkunzippath %@full[%pkfile] %pksel %downloaddirtry ]
If %error ne 0 goto decompressing_error
Echo Scanning files in archive %@full[%pkfile] for viruses ...
set error=%@exec[ %Scanpath %downloaddirtry\*.* %scanopt ]
If %error ne 0 goto dispinfected
Text
Deleting files from directory ...
Endtext
set result=%@exec[%deleteprotect_off >& nul ]
If exist %downloaddirtry\*.* del %downloaddirtry\*.* /y /q >& nul
set result=%@exec[%deleteprotect_on >& nul ]
goto pick
:movefile
:copyfile
:edit file
:execute_file
:shellto4dos
set result=%@exec[%comspec]
goto operations
:viewbuerg
iff exist %@search[%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
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
%cursor_on
Input %%newdes
%cursor_off
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[%desc_list,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
%cursor_on
Inkey /K"yn" Do you want to delete the content of %downloaddirtry (y/n) : %%answer
%cursor_off
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
%cursor_on
Inkey /K"yn" Do you want to move that somewhere ? (y/n) : %%answer
%cursor_off
If "%answer"=="n" goto redisplay
Text
Endtext
%cursor_on
Input Where do you want to move that (ENTER to quit): %%where
%cursor_off
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
%cursor_on
Input Where do you want to unzip %pkfile : %%where
%cursor_off
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
: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 ≡ PKBTM v1.20 (C) 1991,1992 FMMO Publications Informatiques Enr. ≡
Drawhline 1 0 80 1 blu on bla
Return
: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
:out
%afterquit
Popd >& nul
quit
:not_4DOSv40
Echo PKBTM is constantly updated to use the latest 4DOS functions.
Echo As of now, the most recent version of 4DOS is 4.0/rev B1 release.
Echo Please read the file magicn.fmo for more information !
quit
:not4DOS
@echo
@echo 4DOS (tm) is not loaded on your system.
@echo.
@echo Shame on you :-)
@echo.
@echo For PKBTM to run, 4DOS must be loaded on your system.
@echo.
@echo Feel free to download or request the latest version of 4DOS (tm) JPSoftware
@echo from FMMHOST BBS in Sherbrooke, Qc.
@echo.
@echo Please read magicn.fmo for more information.
@echo.
@echo We are an official 4DOS Distribution Site !