
! script name: archive.d/archtxtlist

!A
!A NAME:
!A
!A 	Archive Text List
!A
!A DESCRIPTION:
!A
!A	This script makes a message box from a .txt or .hpgl file in
!A	the archive.
!A
!# see also - htdocs/help.d/archive.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: archive text file list ")

DIM Answer$[256],Destination$[256]
DIM Ques$[256]
DIM D_label$[256]
DIM Choice$[256]
DIM Archive$[512]
DIM Project$[512]
DIM Prefix$[256]
DIM Archive_dir$[512]
DIM Project_dir$[512]
DIM Current_dir$[512]
DIM Revision_dir$[512]
DIM Last_rev$[512]
DIM Filename$[512]
DIM Namelist1$[32000]
DIM Namelist2$[32000]
DIM A$[512]
DEG

Stat= NamedVarStr("archive dir",WsSystemVars,"/usr/weber/archive/",Archive$)

DeActivateUndo
IF NOT DoesFileExist(Archive$) THEN Leave
Archive_dir$= Archive$
Prefix$= "revision"


Start:!

Project_dir:!
Ques$= "SELECT PROJECT TO BE LISTED "
D_label$= "PROJECTS"
Choice$= "selected project"
Answer$= SelectDirectory(Archive_dir$,"*",Ques$,D_label$,Choice$,Prefix$,Current_dir$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "New", "CANCEL"
        GOTO Leave
END SELECT
Answer$= TRIM$(Answer$)
Project$= PathNameFile(Answer$)
Project_dir$= Answer$
IF NOT DoesFileExist(Project_dir$) THEN
        GOTO Project_dir
ELSE
        A$= CurrRevisionName(Project_dir$,Prefix$,"info.txt")
	Revision_dir$= PathNameDirectory(A$)
END IF
IF NOT LEN(Revision_dir$) THEN Project_dir

D_label$= "TEXT FILES"
Choice$= "selected file"
Mask$="*"
Namelist1$=DirectoryNamesStr(Revision_dir$,Mask$,WsAscending,"",".txt")
Namelist2$=DirectoryNamesStr(Revision_dir$,Mask$,WsAscending,"",".hpgl")
Stat=GeneralListBox(D_label$,Choice$,Namelist1$&Namelist2$)

Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT TEXT FILE",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="CANCEL" THEN Leave
LowerSelectBox
Filename$=FileNameString(Revision_dir$,Answer$)

LowerSelectBox

Stat=MessageFileBox(Filename$,Filename$)

GOTO Project_dir

Leave:!
LowerSelectBox

Stat=SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
         LOAD "typecontrol"
ELSE
         LOAD Destination$
END IF
END

