
! script name: filing.d/readjob
! topic: retrieve job files

!A
!A NAME:
!A
!A 	Job File(s) Retrieval
!A
!A DESCRIPTION:
!A
!A 	This script will retrieve a set of
!A 	specified files under a job name.
!A

stat=ChangeLabelStr("ScriptNameStatus","Function: job file(s) retrieval ")

DIM Answer$[256]
DIM Destination$[256]
DIM Dir$[256]
DIM D_label$[256]
DIM Sub_label$[256]
DIM F_label$[256]
DIM Choice$[256]
DIM Mask$[256]
DIM Jobs$(20,2)[15]

DeActivateUndo
Stat= NamedVarStr("retrieve dir",WsSystemVars,"/usr/weber/ST/",Dir$)
D_label$="DIRECTORY"
Sub_label$="SUB DIRECTORIES"
F_label$="FILES"
Choice$="FILE TO OPEN"
Mask$="*.[cnt][mpt][de]"

Num_files= 3
Jobs$(1,1)= "tapefile"
Jobs$(1,2)= ".tpe"
Jobs$(2,1)= "command_file"
Jobs$(2,2)= ".cmd"
Jobs$(3,1)= "notepad"
Jobs$(3,2)= ".nte"

Stat=UserFileBox(Dir$,Mask$,D_label$,Sub_label$,F_label$,Choice$)
Stat=SetInputFormat("a99","")
Stat=GetValue("JOB FILE TO RETRIEVE",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "CANCEL" THEN Leave
LowerFileBox
IF NamedVarVal("save dirs",WsSystemVars,0) THEN V1=CreateVariable("retrieve dir",WsSystemVars,PathNameDirectory(Answer$))

Choice$= Answer$[LEN(Dir$)+1,LEN(Answer$)-4]

FOR J= 1 TO Num_files
	
	Stat= CopyFile(FileNameString(Dir$,Choice$,Jobs$(J,2)),Jobs$(J,1))
NEXT J

Leave:!
	IF (NOT LEN(Destination$)) THEN
		 LOAD "typecontrol"
	ELSE
		 LOAD Destination$
	END IF

END
