I've stumbled upon these really useful functions, but they only seem to work for me in expressions, and when I try to use them in my script, I get the function undefined message. It would be really weird if they didn't implement this feature for scripts..
Unfortunately, you are not missing anything.The easiest and safest workaround is to add a temporary Point Control (or 3D Point Control for toWorld) somewhere with the appropriate expression, harvest the result, and remove the control.You can also try to write your own, it's possible but quite some work.Xavier
To set the expression, you need a host property. If you already have a free 2D/3D property to use (like the null position) then you can it of course, but in some situations you might have to add something (a Point Control, or a Null).
If anyone is still looking for methods to get layers coordinates via ExtendScript, look no further - I've reverse engineered toWorld() and toComp() methods and created a separate class for it https://github.com/rendertom/LST