
! script name: vstrategy.d/tabletovargrp
! var_topic: make a strategy var group from a table

!A
!A NAME:
!A
!A 	Strategy Variable Group From  Table.
!A
!A DESCRIPTION:
!A
!A 	This script will make a strategy variable group from a table.
!A
!B INSTRUCTIONS:
!B
!B	The strategy variable names without the strategy prefix appear
!B	in the first row of the table. The variable name must appear
!B	exactly as it appears in the strategy, but with the first
!B	letter capitalized. For example the strategy variable
!B		Xxx_ext_var_finish_depth should appear as Finish_depth
!B	in the table.
!B
!# see also - htdocs/help.d/vdminfo.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: change strategy var group")

DIM Destination$[512]
DIM Answer$[512]
DIM Filename$[512]
DIM Name$[512]
DIM Dir$[512]


DeActivateUndo
Start:!
stat= NamedVarStr("strategy directory",WsStrategyVars,"/usr/weber/database/strategies/",Dir$)
Stat=UserFileBox(Dir$,"*","DIRECTORY","SUB DIRECTORIES","STRATEGY FILES","STRATEGY FILE")
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT STRATEGY FILE",Filename$)
IF (ExitScript(Destination$)) THEN Leave
IF Filename$= "CANCEL" THEN Leave
LowerFileBox

Name$= PathNameFile(Filename$)
Stat=SetInputFormat("a1",",Y,N,")
Stat=GetValue("CHANGE:"&Name$&"  Yes or No",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "N" THEN Start

Element_loop:!
stat= SetInputFormat("n4","")
Table1=PickEntity("PICK TABLE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Table1) THEN Element_loop

Stat= ChStrategyVarGrp(Filename$,table1)

GOTO Start

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