---------------------------------------------------- --Replaces all Objects that either start with or include the given Name with an instance of the picked Source Object --written by Christoph Bülter 17.12.2010 ---------------------------------------------------- rollout ro_instanceReplaceByName "Instance Replace" width:149 height:181 ( local theSource = undefined global arrTargets = #() pickbutton pkb_source "Pick Object" pos:[4,22] width:141 height:31 edittext edt_wildcard "" text:"Enter Text here" pos:[5,114] width:135 height:16 label lbl1 "Pick Source Object:" pos:[6,3] width:133 height:16 button btn_instance "Instance Replace" pos:[17,141] width:114 height:35 GroupBox grp1 "Target Object Names..." pos:[4,60] width:141 height:76 radiobuttons rdo_mode "" pos:[10,78] width:91 height:32 labels:#("Start with Text", "Include Text") on pkb_source picked obj do ( pkb_source.caption = obj.name as String theSource = obj ) on btn_instance pressed do ( if theSource != undefined and edt_wildcard.text != "" do ( if rdo_mode.state == 1 then ( cmd = "append arrTargets $" + edt_wildcard.text + "*" execute cmd for target in arrTargets do instanceReplace target theSource arrTargets = #() ) else ( cmd = "append arrTargets $*" + edt_wildcard.text + "*" execute cmd for target in arrTargets do instanceReplace target theSource arrTargets = #() ) )--end if ) ) try(destroyDialog gRo_instanceReplaceByName) catch() global gRo_instanceReplaceByName = ro_instanceReplaceByName createDialog gRo_instanceReplaceByName