Hi everybody,
I'm trying to make a skill that renames all the selected objects in the layout with a value that I insert in the form and merging it with a counter.
For example: If I have 30 copied resistors (I1, I2,I3,..., I30), I want to rename them R0.1, R0.2, ..., R0.30 .
At first try I made a single procedure that creates the form and renames. That seemed to work correctly but, if I press the button "cancel" in the form, the procedure continues and renames all the selected objects with the value of the counter (1,2,3...,30).
So I decided to make two procedure, one for the creation of the form and another for the execution of the renaming.
There is only one problem I can't really figure out: how can I pass the name, that I wrote in the form, to the procedure of execution?
Hope someone can help me.
Bye bye :)
Here it is my form:
/*CREATE FORM*/
procedure( change()
let((myform changeName)
/*CHECK LAYOUT VIEW*/
if( (geGetEditCellView()~>cellViewType != "maskLayout")
then hiDisplayAppDBox(
?name 'errorbox2
?dboxBanner "Errore"
?dboxText sprintf( nil "La procedura funziona solo con Layout Window")
?dialogType hicErrorDialog
?buttonLayout 'Close
?dialogStyle 'modal
)
)
changeName=hiCreateStringField(
?name 'changeName
?prompt "Inserire nome"
?defValue ""
?editable t
;?callback "esec()"
)
hiCreateAppForm(
?name 'myform
?formTitle "Change Instance Name"
?fields list( changeName )
?callback "exec(changeName~>value)"
)
hiDisplayForm(myform)
)
)
/*EXECUTION RENAMING*/
procedure( exec()
let( (changeName nome num)
nome = changeName~>value
if( (rexMatchp("symbol" buildString(geGetSelSet()~>viewName)) == nil) && (rexMatchp("lay" buildString(geGetSelSet()~>viewName)) == t)
then for(i 1 geGetSelSetCount()
sprintf(num "%d" i)
geGetSelSet()~>name = strcat(nome num)
geSelectNextInSelSet()
)
)
)
)