Skip to main content
1-Visitor
November 29, 2016
Solved

Doing manual edits on a 4 digit text number. Need macro for IsoDraw to match manual text edit

  • November 29, 2016
  • 1 reply
  • 1936 views

Doing manual edits on a 4 digit text number but noticed when I call up the Object info that the name shows the previous text. For example change a text 0401 to 0462. When I do a Object info it still shows 0401 in the name (see attachment). So I want to develop a macro that will change the object info name to match the manual edit. In this case 0462. Here's the macro code I have so far:

Here's the code:

Macro change_name_in_object_info

Define el as Element

Define Text as String

Define output as String

Define text1 as string

el=ActiveDoc.FirstSelectedElement

Select if Type is "Text"

        WHILE (Exists (el) = true)

text1=Text

el.info.name = text1

el = el.nextSelectedElement

        End While

select none

End Macro

Best answer by thendricks

Main issue was you were doing your select after assigning value to el. Try this.

Macro change_name_in_object_info

    Define el as Element

    Define Temp as string

   

    Select if Type is "Text"

    el = ActiveDoc.FirstSelectedElement

    While (Exists(el) = true)

        Temp = el.text.string

        el.Info.Name = Temp

        el = el.NextSelectedElement

    End While

    Select None

End Macro

1 reply

12-Amethyst
November 30, 2016

Main issue was you were doing your select after assigning value to el. Try this.

Macro change_name_in_object_info

    Define el as Element

    Define Temp as string

   

    Select if Type is "Text"

    el = ActiveDoc.FirstSelectedElement

    While (Exists(el) = true)

        Temp = el.text.string

        el.Info.Name = Temp

        el = el.NextSelectedElement

    End While

    Select None

End Macro

RubenCote1-VisitorAuthor
1-Visitor
November 30, 2016

Trevor the code you posted worked like a charm. Great as always! Thank you for helping out.