
! script name: vedit.d/replacename
! var_topic: replace variational name reference

!A
!A NAME:
!A
!A      Replace Variational Name  Reference
!A
!A DESCRIPTION:
!A
!A      Replace Variational Name  Reference
!A
!B INSTRUCTIONS:
!B
!B 	NO HELP AVAILABLE AT THIS TIME
!B
!# see also - htdocs/help.d/vdminfo.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: replace name reference")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM Newname$[256]

DeActivateUndo
Start:!
Stat=SetInputFormat("a99","")
Stat=GetValue("NAME TO BE REPLACED",Answer$)
IF ExitScript(Destination$) THEN Leave
IF Answer$="CANCEL" THEN Leave

N=POS(Answer$,"=")
IF N>1 THEN
	Answer$=Answer$[1,N-1]
	Answer$=TRIM$(Answer$)
END IF
Name$=Answer$

Stat=SetInputFormat("a99","")
Stat=GetValue("REPLACEMENT NAME",Answer$)
IF ExitScript(Destination$) THEN Leave
IF Answer$="CANCEL" THEN Leave

N=POS(Answer$,"=")
IF N>1 THEN
	Answer$=Answer$[1,N-1]
	Answer$=TRIM$(Answer$)
END IF
Newname$=Answer$

Stat= ChangeVarNameRef(Name$,Newname$)


GOTO Start


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