
! script name: turbopost.d/turbovar

!A
!A NAME:
!A
!A 	CHANGE POST VARIABLE
!A
!A DESCRIPTION:
!A
!A 	This script raises the TurboPost variables selection box and allows
!A 	the user to select variables to be edited.  The variable list may vary
!A 	with each TurboPost.  The following are some examples of TurboPost
!A 	variables that may be available for editing:
!A
!A 			Tool_num
!A 			Tool_dia
!A 			Length_comp
!A 			Dia_comp
!A 			Feed
!A 			Zfeed
!A 			Speed
!A 			Rap_level
!A 			Finish_depth
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VARIABLE: The selection box with the available list of variables
!B 		that may be edited will automatically appear for a selection
!B 		to be made.  Once a selection has been made, the value for
!B 		that variable may be edited and placed in the command file.
!B
!# see also - htdocs/help.d/millturbo.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: change post variable ")

DIM Answer$[256]
DIM Name$[256]
DIM Destination$[256]
DIM Command$[256]
DIM Varstr$[256]
DIM Var_name$[256]
DIM Prompt$[256]

DEG

DeActivateUndo
Start:First=InitCmdMenu(0,1)

Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT VARIABLE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

IF Answer$="CANCEL" THEN  LOAD "turbopost.d/turbocontrol"

ON ERROR GOTO Start
Variable_num=VAL(Answer$)

Command$="EDIT: Var_num= "&VAL$(Variable_num)&";"

Variable_type=InterpretCmd(Command$)
Value=CurrActionVal(Varstr$)
Stat=CurrActionName(Var_name$)

LowerSelectBox

Prompt$="EDIT VARIABLE "&Var_name$

SELECT Variable_type
CASE 0
	GOTO Start
CASE 1
	Stat=SetInputFormat("n0=","")
	Stat=SetEqualsValue(Value)
	Answer=GetValue(Prompt$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	 Command$="ASSIGN: "&Var_name$&"= "&VAL$(Answer)&";"
CASE 2
	Stat=SetInputFormat("n4=","")
	Stat=SetEqualsValue(Value)
	Answer=GetValue(Prompt$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	 Command$="ASSIGN: "&Var_name$&"= "&VAL$(Answer)&";"

CASE 3
	Stat=SetInputFormat("a99=","")
	Stat=SetEqualsValue(Value,Varstr$)
	Answer=GetValue(Prompt$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	Command$="ASSIGN: "&Var_name$&"= "&CHR$(34)&Answer$&CHR$(34)&";"
END SELECT

Stat=OutputCmdBuff(Command$,1)
UpdateCmdFile

GOTO Start


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