home *** CD-ROM | disk | FTP | other *** search
- @ECHO OFF
- REM
- REM VIEWFILE.BTM Copyright 1993 by Bernd Schemmer Version 2.00
- REM
- REM Function: View file/archivs
- REM
- REM Usage: ViewFile {file|dir}
- REM
- REM VIEWFILE.BTM is freeware. So use and share it freely!
- REM Send any comments and problem reports to
- REM
- REM Bernd Schemmer
- REM Bäckerweg 48
- REM 60316 Frankfurt
- REM Germany
- REM Phone: +49 (069) 4 97 84 04 (only in the evening of MEZ)
- REM
- REM Last Update: 01.10.93
- REM
- REM Note: Set the variable "ArcPath" if your packers are in a directory
- REM which is not in the path.
- REM
- REM ViewFile supports the archivs .ARJ, .ZIP, .LHA, .LZH,
- REM .ICE, .SQZ, .ARC, .PAK and .ZOO.
- REM
- REM History: V1.00 - first release
- REM V1.10 - minor changes
- REM V1.20 - ViewFile is now compound char independent
- REM ViewFile now returns the following errorlevels:
- REM 0 = okay
- REM 1 = error
- REM 2 = user pressed ALT-X
- REM V1.30 - added support for .ARC- and .PAK-archivs
- REM V2.00 - changes for 4OS2
- REM NOTE: You must use % as parameter char to use this
- REM BTM with 4OS2
- REM
- SETLOCAL
-
- REM directory with the pack programr(s)
- IFF "%_DOS%" == "DOS" THEN
- *SET arcPath=C:\DOS\TOOLS\ARCHIV
- ELSE
- *SET arcPath=C:\OS_2\TOOLS\ARCHIV
- ENDIFF
-
- REM Check OS and 4DOS version
- IFF "%_DOS" != "OS2" THEN
- IFF "%_4VER" LE "4.00" .OR. "%_DOSVER" LE "3.30" THEN
- ECHO. Sorry, ViewFile needs DOS 3.3+ and 4DOS 4+!
- ECHO. (currently you have DOS %_DOSVER and 4DOS %_4VER)
- QUIT 1
- ENDIFF
- ENDIFF
- REM Check free env and alias space
- IFF "%_DOS" == "DOS" .AND. 0%_ENV% LE 300 THEN
- ECHO. Sorry, ViewFile needs at least 300 byte free environment.
- ECHO. (currently you have %_ENV free bytes in the environment)
- QUIT 1
- ENDIFF
- REM get path for the temp files
- *SET TMPFIL=%@UNIQUE[%TMP%]
- IF NOT EXIST %TMP%CON *SET TMP=%TMP%\
- IF NOT EXIST %TMP%CON *SET TMP=C:\
-
- :FileLoop
- IF "%file%" =="" *SET file=*.*
-
- IFF "%1%" != "" THEN
- *SET file=%1
- SHIFT
- ENDIFF
-
- :DirLoop
- IFF IsDir %file% THEN
- IFF "%file%" =="." THEN
- CLS
- SCRPUT %@eval[%_rows-2] 0 %_fg on %_bg Current Directory is %_cwd
- SCREEN %@eval[%_rows-1] 0
- INPUT Enter the new directory: %%f
- IFF "%f%" != "" THEN
- IFF isDir %f% THEN
- SET file=%f%
- ELSE
- CLS
- SCRPUT %@eval[%_rows-2] 0 %_fg on %_bg [FileView] Error: %f% is NOT a directory
- SCRPUT %@eval[%_rows-1] 0 %_fg on %_bg Press any key to continue ...
- INKEY %%f
- IFF "%f%" =="@45" THEN
- CLS
- QUIT 2
- ENDIFF
- ENDIFF
- ENDIFF
- ENDIFF
- cdd %file%
- *SET file=%_cwds%*.*
- UNSET /Q f
- ENDIFF
-
- :ShowLoop
- IFF %@index[%file%,*] != -1 .OR. %@index[%file%,?] != -1 THEN
- *SET mask=%file%
- UNSET /Q file
- select /A-H-S /OGEN SET file=[%mask%]
- *SET file=%@word[0,%file%]
- IFF "%file%" =="" THEN
- IFF "%1%" != "" THEN
- GOTO FileLoop
- ELSE
- QUIT 0
- ENDIFF
- ENDIFF
- IF IsDir %file% GOTO DirLoop
- ENDIFF
-
- CLS
- *SET t=%@upper[%@ext[%file%]]
-
- *SET f=%@unique[%tmp%]
-
- IFF "%t%" == "" THEN
- list %file%
-
- ELSEIFF "%t%" == "ARJ" THEN
-
- %arcPath%arj l %file% >&!%f%
- :ShowArj
- *SET n=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]]
- IF "%n%" =="" GOTO EndView
- %arcPath%arj p %file %n% |& list /s
- GOTO /I ShowArj
-
- ELSEIFF "%t%" == "LZH" .OR. "%t%" == "LHA" .OR. "%t%" == "ICE" THEN
- %arcPath%lha l %file% >&!%f%
- :ShowLZH
- *SET n=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]]
- IF "%n%" =="" GOTO EndView
- %arcPath%lha p %file %n% |& list /s
- GOTO /I ShowLZH
-
- ELSEIFF "%t%" == "SQZ" THEN
- %arcPath%sqz l %file% >&!%f%
- :ShowSQZ
- *SET n=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]]
- IF "%n%" =="" GOTO EndView
- %arcPath%sqz p %file %n% |& list /s
- GOTO /I ShowSQZ
-
- ELSEIFF "%t%" == "ZIP" THEN
- %arcPath%pkunzip -v %file% >&!%f%
- :ShowZIP
- *SET n=%@WORD[8,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]]
- IF "%n%" =="" GOTO EndView
- %arcPath%pkunzip -c %file% %n% |& list /s
- GOTO /I ShowZIP
-
- ELSEIFF "%t%" == "ZOO" THEN
- %arcPath%zoo l %file% >&!%f%
- :ShowZOO
- *SET n=%@WORD[7,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]]
- IF "%n%" =="" GOTO EndView
- %arcPath%zoo -p %file %n% |& list /s
- GOTO /I ShowZOO
-
- ELSEIFF "%t%" == "PAK" THEN
- %arcPath%pak l %file% >&!%f%
- :ShowPAK
- UNSET /Q n
- *SET n=%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]
- IF "%n%" =="" GOTO EndView
- *SET n=%@WORD[0,%n%].%@WORD[1,%n%]
- %arcPath%pak p %file %n% |& list /s
- GOTO /I ShowPAK
-
- ELSEIFF "%t%" == "ARC" THEN
- %arcPath%pkunpak -v %file% >&!%f%
- :ShowARC
- *SET n=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_COLUMNS-1], Select a file to view or ESC to abort ]]
- IF "%n%" =="" GOTO EndView
- %arcPath%pkunpak -c %file %n% |& list /s
- GOTO /I ShowARC
-
- ELSE
- list %file%
- ENDIFF
-
- :EndView
- IF EXIST %f% DEL /Q %f%
- *SET file=%_cwds%*.*
- GOTO ShowLoop
-
-