home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
UT
/
UT070.ZIP
/
MENUS.EXE
/
GOFILE.MNU
< prev
next >
Wrap
Text File
|
1989-12-07
|
2KB
|
86 lines
Comment
=============================================================
GOFILE.MNU Copyright 1989 by Marc Perkel
This example allows you to find a file on your hard disk or
network and go to the directory where it is.
It requires that you have WHEREIS from the Computer Tyme DOS
ToolBox, or a WHEREIS type program that can scan your drive and
output complete file names that can be redirected to a temporary
file.
Make sure to create a file called GOFILE.BAT containing:
@ECHO OFF
MARXMENU GOFILE %1
=============================================================
EndComment
Var ChooseFiles Choice NewPath Mask TmpFile W BoxDim
ClearScreenOnExit Off
ClearScreenFirst Off
TextColor Green Black
ExitCode = 0
Mask = UpperCase(ParamStr(2))
Writeln
;------ exit if mask not specified
if Mask = ''
Writeln 'Make sure you have created GOFILE.BAT.'
Writeln 'Usage: GoFile <mask>
ExitMenu
endif
;Run WHEREIS and redirect the output to a temporary file, then
;read the output file into a string array and delete the file.
Write 'Scanning for ' Mask ' Files ... '
TmpFile = UniqueFileName
Execute 'WHEREIS ' + Mask + '>' + TmpFile
ReadTextFile TmpFile ChooseFiles
DelFile TmpFile
Writeln
BoxBorderColor Green Blue
BoxInsideColor Yellow Blue
BoxHeaderColor Yellow Mag
;------ this calculates the size and position of the pick window.
if NumberOfElements(ChooseFiles) > 1
BoxDim[3] = Min(LongestLine + 6,ScreenWidth - 6)
BoxDim[4] = Min(NumberOfElements(ChooseFiles) + 2,ScreenHeight)
BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1)
BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),1)
DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4]
Choice = PickOne ChooseFiles
endif
if NumberOfElements(ChooseFiles) = 1 then Choice = ChooseFiles[1]
if Choice = '' then ExitMenu
;------ Here we remove the file name from the path.
W = length(Choice)
while mid(Choice,W,1) <> '\'
W = W - 1
endwhile
NewPath = Left(Choice,W - 1)
if length(NewPath) = 2 then NewPath = NewPath + '\'
ChDir NewPath
if pos('$P',UpperCase(ReadEnv('PROMPT'))) > 0 then ExitMenu
;------ If the users prompt does not show the current path, we show it here.
TextColor Green Black
Writeln
Writeln 'Current Path = ' Path