I'm new to scripting for after effects. I have already done a script that works fine, but now I want to make it dockable.
I search, read, and practice but the code that supposedly works, does not for me.
Does anybody know what I'm doing wrong?
I'm no expert, there is a very nice guide here: http://www.kahrel.plus.com/indesign/scriptui-2-0.pdf, but here are few comments:
in line 4, replace: "statictext by: "statictext".
At this point your function createUI builds a palette but doesnt show it nor return it. You need a Window.show() somewhere. That's the strict minimum, but there are other options (see the guide for that).
1- You can either write a line
just before the end of your function. In that case, when you call createUI(thisObj), it will build then automatically show the palette.
But you will be in trouble accessing the palette data (for instance: nLayers).
2- or you can make the function return the whole palette. Instead of vendana.show() you write:
In that case, to build and show the palette you write
var ventana = createUI(this);
now ventana is a Window object in your script and you can access its properties. Actually since you didnt explicitely name the palette properties it's not so easy. To read the nLayers value you'll have to do:
var x = parseInt(vendana.children.children.text);
x = (isNaN(x) || x<1) ? 1 : x; //etc
To make things easier you can name the palette properties upon creation (the ones that you will need to access), like this:
Finally I made it Work! thanks a lot Xavier, your method worked just fine. The only thing I had to change was the ".show()" method, wich doesn't work with ScriptUI panels in After Effects. There is a diference (from what i had noticed) between the script panels and the ScriptUI panels in After Effects: if i left "undefined" in the alignment of an element in the panel, it shows up just fine. But, the only way I could make appear a button, a text, or whatever in a ScriptUI panel, was giving to After Effects Specific coordinates... otherwise it just won't work.
Once again, thanks for your reply.. I leave you with the code that worked for me... hope it helps some one else...
(as always, I have to excuse me for my english... is not my native tong)