
! script name: edit.d/changetoolname
! topic: change tool entity name

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

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

Start:!
No_box=ToolSelectBox("TOOLS","selected tool")
IF No_box THEN Leave

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

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

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