Comment ============================================================= DM3PD.MNU Copyright 1990 by Marc Perkel This example allows you to select a directory based on a partial name match. This example was written to work under DM3 but can be run from the command line by typing MARXMENU DM3PD. It requires that you have PIPEDIR from the Computer Tyme DOS ToolBox, or a PIPEDIR type program that can scan your drive and output complete file names that can be redirected to a temporary file. ============================================================= EndComment Var PickFiles SelFiles NewPath PickName SearchSt W X Y Z BoxDim ClearScreenOnExit Off PickName = 'C:\PD.PIC' ;default name that Pich Directory Uses Comment ======== The default list that Pick Directory uses can be overridden by using the command SET PD.EXE=/$FileName. This next routine checks to see if this is so. ======== EndComment SearchSt = ReadEnv('PD.EXE') if SearchSt <> '' W = pos('/$',SearchSt) if W > 0 SearchSt = Mid(SearchSt,W + 2,255) PickName = NextWord(SearchSt) endif endif ;------ If file doesn't exist, exit here. if not ExistFile(PickName) then ExitMenu BoxBorderColor Green Brown BoxInsideColor Yellow Brown BoxHeaderColor Yellow Mag DrawBox 31,9,44,5 Writeln ' Enter partial name of the directory' Writeln ' where you want to go. Write ' > ' SearchSt = UpperCase(Readln) if SearchSt = '' then ExitMenu ClearScreen TextColor Grey Brown Write ' Loading ' TextColor Yellow Brown Write SearchSt TextColor Grey Brown Write ' Directories ... ' TextColor Yellow Brown ReadTextFile(PickName,PickFiles) if NumberOfElements(PickFiles) = 0 then ExitMenu ;------ Here we pick out the ones that match what we want. W = 0 X = 1 Y = 0 Z = NumberOfElements(PickFiles) while X <= Z if pos(SearchSt,PickFiles[X]) > 0 W = W + 1 SelFiles[W] = PickFiles[X] Y = Max(Y,length(SelFiles[W])) endif X = X + 1 endwhile EraseTopWindow if W = 0 then ExitMenu ;------ This calculates the size and position of the pick window. BoxDim[3] = Min(Y + 6,ScreenWidth - 6) BoxDim[4] = Min(W + 2,ScreenHeight) BoxDim[1] = Max(Min(50,ScreenWidth - BoxDim[3] - 4),1) BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),1) DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4] NewPath = PickOne SelFiles if NewPath = '' then ExitMenu ;------ Change to selected directory ChDir NewPath