
! script name: edit.d/changeopername
! topic: change operation entity name

!A
!A NAME:
!A
!A 	CHANGE OPERATION ENTITY NAME
!A
!A DESCRIPTION:
!A
!A 	This script will change the name of an existing operation entity.
!A
!B INSTRUCTIONS:
!B
!B 	OPERATION TO BE CHANGED: Select the name of the operation to change.
!B
!B 	NEW OPERATION NAME: Enter the new operation name.
!B
Stat=ChangeLabelStr("ScriptNameStatus","change operation name ")

DIM Destination$[256],Name$[256]

Start:!
No_box=UserSelectBox("OPERATIONS","selected operation",WsOperation,WsUserSelect)
IF No_box THEN Leave

Stat=SetInputFormat("a99","")
Stat=GetValue("OPERATION TO BE CHANGED",Name$)
IF ExitScript(Destination$) THEN Leave
If Name$= "CANCEL" THEN Leave

OperData=FindUserData(Name$,WsOperation)
IF ValidGeometry(OperData) THEN
	LowerSelectBox
	Stat= SetEditString(Name$)
	Stat=GetValue("NEW OPERATION NAME",Name$)
	IF ExitScript(Destination$) THEN Leave
	IF Name$= "CANCEL" THEN Leave
	Stat= ChangeDataName(OperData,Name$)
END IF
GOTO Start

Leave:!
LowerSelectBox
stat= SetInputFormat("n4","")
IF NOT LEN(Destination$) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
