Script - How to find the Attribute name in each node selected

Hi there .

I want to set in some attribute in my node .

For exemple i create a node write
var waly = node.add(node.root(),“writeLy” , “WRITE”,-60, 30, 0); // le write layout
and i want to set a New Drawing Filename
node.setTextAttr( “Top/writeLy”, “DRAWING_FILENAME”, 0, “Mon nom”)
but it doesnt work, i suppose i dont have the good Attribute name .

Can we find somewhere an attribute list for the node ?

Thanks by advance .

Michel

This is always a challenge to find out the entry of the right attribute. In online documentation, there is some information and samples at http://docs.toonboom.com/help/harmony-12-2/premium/scripting/introduction-scripting.html

What I do normally is creating a empty scene and make or change the option I want in layer properties. And then save the scene and then open the saved scene file (.xstage) in text edit and look for the value.

The only thing is as for the drawing (or layer) name, you can modify it or clone it as long as it is already created. However I do not think it is possible to create an empty drawing node without physically existing drawing layer since each drawing created requires unique drawing ID and needs to be recorded on separate file. If it does not work, you better contact support.

Yeaaah thanks for your answer , it’s really helpfull .

After searching in the doc, i fund a way to list all attributes for a selected node .

var n=selection.selectedNode(0); // node selected
var myList = node.getAttrList( n, 1); // attributes list

// boucle pour lister les noms des attributs
for (i=0;i<100;i++){
MessageLog.trace(myList[i].keyword());

you ll can find a list in message log

See you .

Hi MichelM,

the ‘node.getAttrList’ function looks great.

Would you mind telling me where exactly you found it, please?

stefman

Hello stefman ,

What did you mean by “where exactly you found it”?

if you talk about “node.getAttrList” i found it in the doc doc online.

if you talk about the result , you need to select a node lunch the script and open the messagelog window.

Michel

hooooo,

True, it doesnt exist in the toonBoom doc .
But i ll find it if toonboom’s script editors . Write the aord “node” select it and do right click .

You’ll see all funtions for the “node” classes

Link for see the picutre

Michel

stefman

Posted 1 hour ago on 02/02/2016 at 08h00

What I wanted to say is that I didn’t find the node.getAttrList() command any where in the documentation.

It works fine. But, I still didn’t find it in the doc, not even in the Script Interface Documentation of Harmony 12 http://docs.toonboom.com/help/harmony-12/scripting/script/a00041.html .

Might this be a new command that has not been integrated into the documentation yet?

stefman

Cool, thank you Michel.

I didn’t know yhe right click trick to reveal the related functions.

stefman