
! script name: property.d/delpropfile
! topic: delete an info packet file

!A
!A NAME:
!A
!A 	Delete Property File
!A
!A DESCRIPTION:
!A
!A 	This script deletes an info packet file.  Synergy does not check
!A 	references to the file after the packet file has been deleted.
!A
!# see also - htdocs/help.d/property.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: delete packet file")

DIM Destination$[512]
DIM Answer$[512]
DIM A$[512]
DIM Name$[512]
DIM Prop_dir$[512]
DIM Class_dir$[512]
DIM Class_name$[512]
DIM Prop_name$[512]
DIM Filename$[512]
DIM Class_name$[512]
DIM D_label$[512]
DIM Choice$[512]
DIM Current_dir$[512]
DIM Ques$[512]

Stat= NamedVarStr("properties dir",WsSystemVars,"/usr/weber/database/properties/",Prop_dir$)

Start:!
D_label$="PACKET CLASSES"
Choice$="CLASS SELECTED"
Ques$= "PACKET CLASS DIRECTORY  List  "
Answer$= SelectDirectory(Prop_dir$,"*",Ques$,D_label$,Choice$,"",Current_dir$)
IF (ExitScript(Destination$)) THEN Leave
IF  Answer$= "CANCEL" THEN Leave
Answer$= TRIM$(Answer$)
Class_dir$= Answer$
Class_name$= PathNameFile(Answer$)

Prop_name:!
D_label$= Class_name$
Choice$="PACKET SELECTED"
Stat=DirListBox(Class_dir$,"*",D_label$,Choice$,WsAscending)
IF Stat=1 THEN Start

File_name:stat= SetInputFormat("a99","")
stat= GetValue("PACKET FILE NAME ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF NOT LEN(Answer$) THEN File_name
IF Answer$="CANCEL" THEN Leave

Filename$= FileNameString(Class_dir$,Answer$)
Prop_name$= Answer$
LowerSelectBox

stat= SetInputFormat("a1",",Y,N,")
stat= GetValue("DELETE "&Prop_name$&" Yes or No ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "Y" THEN
	Stat=RemoveFile(Filename$)
END IF

GOTO Prop_name

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


