
! script name: filing.d/readgroup
! topic: read and merge file

!A
!A NAME:
!A
!A 	Merge
!A
!A DESCRIPTION:
!A
!A 	This script allows a file to be read into a group.
!A 	
!A
!B INSTRUCTIONS:
!B
!B 	SELECT EXISTING FILE: The selection box will appear
!B 		at this time for a selection to be made.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: merge ")

DIM Answer$[256]
DIM Destination$[256]
DIM Name$[256]
DIM Dir$[256]
DIM D_label$[256]
DIM Sub_label$[256]
DIM F_label$[256]
DIM Choice$[256]
DIM Mask$[32]
DIM Group_name$[256]

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$="[A-Za-z0-9]*"

Stat=UserFileBox(Dir$,Mask$,D_label$,Sub_label$,F_label$,Choice$)
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT EXISTING FILE",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$))

Name$=Answer$

Stat=SetInputFormat("a99","")
Stat=GetValue("GROUP NAME",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Group_name$= Answer$

Group=ReadGroupFile(Group_name$,Group_type,Name$)

Leave:!
LowerFileBox
Stat=SetInputFormat("n4","")

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


