Signe Marie Sanne asked how to change the name of a custom property:

> set the <newname> of this stack to the <name> of this stack
> set the <name> of this stack to empty
> 
> This gives me a new custprop with the old content, but I'm still stuck with
> the old custProp (without any content), and all my efforts to get rid of it
> by scripting, have been without success. There must be an easier way which
> I so far have overseen. Thanks in advance.

For this kind of problems it always a good idea to look at MetaCard itself.
In this case you know that in the dialog box "Custom Properties" is a button
"Delete", witch delete the selected property. With

topLevel "Custom Properties"

you can edit this dialog (DONT SAVE). Choose the arrow tool, and just
doubleclick on "Delete" to edit the script. Here I've done it for you: After
a bit of message tracing ;-) I've made this function handler you can use
like:

get changePropertyName("button id 1003",propOld,propNew)

In which propOld is the name of the old property, and propNew is the new
name.

start:
propOld: BLAbla

get changePropertyName("button id 1003",propOld,propNew)

result:
propNew: BLAbla

The script behind this:

-- place this in the stack script
function changePropertyName object oldPropName newPropName
  get the customKeys of object -- are now in it,but ONLY THE NAMES
  put newPropName & return before it -- creates the NAME of the new prop
  put the oldPropName of object into oldPropCont -- saves the content
  delete line lineOffset(oldPropName,it) of it -- delete the oldProp (in it)
  
  set the customKeys of object to it -- makes the changes
  set the newPropName of object to oldPropCont -- moves the content
end changePropertyName

Regards,
Sjoerd Op 't Land


This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm

Reply via email to