! script name: turbopost.d/turbocmd

!A
!A NAME:
!A
!A 	SELECT POST COMMAND
!A
!A DESCRIPTION:
!A
!A 	This script raises the TurboPost COMMANDS selection box for the post
!A 	selected.  Some examples of commands are:
!A
!A 		STARTUP
!A 		END_CODES
!A 		TOOLCH
!A 		CUT_CONTOUR
!A
!A 	The command menu selection will vary depending on the TurboPost
!A 	format that was selected.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT COMMAND: The TurboPost COMMANDS selection
!B 		box will automatically appear to allow the
!B 		selection of a TurboPost command.
!B
!# see also - htdocs/help.d/millturbo.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: select post command ")

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

DEG

DeActivateUndo
Start:First=InitCmdMenu(0,0)

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

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

ON ERROR GOTO Start
Command_num=VAL(Answer$)
OFF ERROR

Command$="CMD: Cmd_num= "&VAL$(Command_num)&";"

Command_type=InterpretCmd(Command$)
Stat=CurrActionName(Command_name$)
Stat=CurrActionVal(Ques_file$)

LowerSelectBox

Stat=MakeCurrActive

Exit_loop=0
Ques_count=1
First_ques=1
Question_loop:!

	Exit_loop=AskCommandQues(Ques_file$,Ques_count)

	IF Exit_loop THEN Command_load

	Value=CurrActionVal(Varstr$)
	Variable_type=CurrActionTyp
	Stat=CurrActionName(Var_name$)
	Stat=CurrActionPrompt(Prompt$)

	SELECT Variable_type
	CASE 10
		Stat=CurrActionName(Command$)
	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","")
			Answer=GetValue(Prompt$,Answer$)
			IF (ExitScript(Destination$)) THEN Leave
			Command$="ASSIGN: "&Var_name$&"= "&CHR$(34)&Answer$&CHR$(34)&";"

	END SELECT
	IF Variable_type THEN
		Stat=OutputCmdBuff(Command$,First_ques)
		First_ques=0
	END IF
	Ques_count=Ques_count+1

Endquesloop:IF NOT Exit_loop THEN Question_loop


Command_load:!

IF First_ques THEN
	ON ERROR GOTO Skip_it
	PURGE "command_buffer"
Skip_it:OFF ERROR
END IF

SELECT Command_type
CASE TpMillPaths,TpMillPath,TpMillPathNS,TpMillPathsNS
	 LOAD "turbopost.d/pickpaths"
CASE TpMillSurfaces,TpMillSurface
	 LOAD "turbopost.d/picksurfaces"
CASE TpLathePaths,TpLathePath,TpLathePathNS,TpLathePathsNS
	 LOAD "turbopost.d/picklathepaths"
CASE TpMillHoles,TpLatheHoles,TpMillHole,TpLatheHole
	 LOAD "turbopost.d/nonseqholes"
CASE TpMillxypoints,TpMillxypoint,TpLathePoint,TpLathePoints
	 LOAD "turbopost.d/manualhole"
CASE TpMillxyzpoints,TpMillxyzpoint
	 LOAD "turbopost.d/manualzhole"
CASE TpPathGroups,TpPathGroup
	 LOAD "turbopost.d/pickgroups"
CASE TpManualCodes
	 LOAD "turbopost.d/mancodes"
CASE TpFilePick
	 Stat=CurrActionPck(Ques_script$)
	 LOAD "turbopost.d/"&Ques_script$
CASE TpNoPick
	Stat=OutputCmdBuff(Command_name$,First_ques)
	UpdateCmdFile
CASE TpRuledSurfs,TpRuledSurf
	 LOAD "turbopost.d/pickruled"

END SELECT

GOTO Start

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