
! script name: edit.d/editoperation
! topic: edit operation file

!A
!A NAME:
!A
!A 	Operation File
!A
!A DESCRIPTION:
!A
!A 	This script allows an operation file to be edited.
!A 	Some examples of operations are:
!A
!A 		drilling
!A 		tapping
!A 		capscrews
!A 		dowels
!A
!A 	Remember, these operations may vary depending on what is
!A 	defined for the particular system being used.
!A
!B INSTRUCTIONS:
!B
!B 	INPUT OPERATION CLASS: The selection box with the available
!B 		list of operation classes that may be edited, will
!B 		automatically appear for a selection to be made.
!B
!B 	INPUT OPERATION FILE NAME TO BE EDITED: Once an operation
!B 		class has been selected, the selection box with the
!B 		available list of operation files will automatically
!B 		appear for a selection to be made.  Once a selection
!B 		has been made, a xed editor window will be brought
!B 		up with the data that may be edited.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: operation file ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM File_name$[256]
DIM Dir$[256]
DIM D_label$[256]
DIM Choice$[256]
DIM Namelist$[2000]
DIM Namelist2$[2000]
DIM Mask$[32]
DIM Op_class$[256]
DIM Editor$[256]

Stat= NamedVarStr("file editor",WsSystemVars,"notepad.exe",Editor$)
Flip_file= NamedVarVal("flip crlf",WsSystemVars,0)

Start:!
Stat=SetInputFormat("a1=",",M,L,")
Stat=SetEqualsValue(0,"M")
Stat=GetValue("Mill or Lathe OPERATION",Answer$)
IF ExitScript(Destination$) THEN Leave
IF Answer$="M" THEN
	Stat= NamedVarStr("operations dir",WsSystemVars,"/usr/weber/util/tooldata/operations2_in/",Dir$)
ELSE
	Stat= NamedVarStr("loperations dir",WsSystemVars,"/usr/weber/util/tooldata/loperations_in/",Dir$)
END IF
D_label$="OPERATION CLASS "
Choice$="OPERATION CLASS SELECTED"
Mask$="*"
Stat=DirectoryNames(Dir$,Mask$,Namelist$)
Stat= AlphabeticalOrder(Namelist$,",",WsAscending,Namelist2$)
Stat=GeneralListBox(D_label$,Choice$,Namelist2$)

Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT OPERATION CLASS",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="CANCEL" THEN Leave
Op_class$= FileNameString(Dir$,Answer$)

D_label$="OPERATIONS AVAILABLE"
Choice$="OPERATION SELECTED"
Mask$="[a-z,A-Z]*"
Stat=DirectoryNames(Op_class$,Mask$,Namelist$)
Stat= AlphabeticalOrder(Namelist$,",",WsAscending,Namelist2$)
Stat=GeneralListBox(D_label$,Choice$,Namelist2$)

Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT OPERATION FILE NAME TO BE EDITED",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="CANCEL" THEN Leave
File_name$= FileNameString(Op_class$,Answer$)

Stat=EditFile(Editor$,File_name$,Flip_file)

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