
! script name: layers.d/hidelayers
! topic: list layers and allow selected layer to be hidden

!A
!A NAME:
!A
!A 	Hide selected layers
!A
!A DESCRIPTION:
!A
!A	Finds all layers and displays them one at a time
!A	allowing the user to hide individual layers
!A
!B INSTRUCTIONS:
!B
!B      HIDE LAYER Y or N ( Layer Information )?
!B
!B      Answering Yes will hide the layer
!B

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

DIM Layer$[8192]
DIM Active$[8192]
DIM Destination$[256]
DIM Answer$[256]
DIM File$[256]


PlotAllData
File$="/tmp/layerlist"
Stat=ListLayers(File$)

Active$=","
Stat=SetPlotLayers(",0,",0)
UpdatePropPlot
Stat=SetInputFormat("a1",",Y,N,")
Stat=GetValue("Hide Layer - Yes or No ( Layer 0 )",Dest$)
IF (ExitScript(Destination$)) THEN Leave
IF Dest$<>"Y" then
	Active$=Active$&"0,"
END IF

Num_lines=FileLineCount(File$)
FOR J= 0 TO Num_lines
        Stat= GetFileLine(File$,J,Answer$)
	P=POS(Answer$,"#")
	IF P>0 THEN
	LayerNum=VAL(Answer$[p+1])
	Stat=SetPlotLayers(","&VAL$(LayerNum)&",",0)
	UpdatePropPlot
	Stat=SetInputFormat("a1",",Y,N,")
        Stat=GetValue("Hide Layer - Yes or No ("&Answer$&")",Dest$)
	IF (ExitScript(Destination$)) THEN Leave
	IF Dest$[1,1]<>"Y" then
		Active$=Active$&VAL$(LayerNum)&","
	END IF
	END IF

NEXT J

Stat= RemoveFile(File$)
Stat=SetPlotLayers(Active$,0)
UpdatePropPlot

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

