1) You need to be careful with the TextTarget path, from what I can tell it's a relative path. As in "How do I get to the target from where I currently am?" The returned "Path" key is an absolute path, how do you get to the currently selected layer from the very bottom layer in the layers palette? This also means that (0, 0, [1], True) will always point to the bottom most object the in the current object group, or layer, or group layer. So if you have two text objects in the same vector layer, then (0,0,[1], True) will always select the bottom most one.
You can deal with this in one of two ways. 1) You can use the "SelectLayer" command with (-9999,-9999,[],False) to select the bottom most layer in the layers palette. Then the Path variable will correctly reference a relative path back to the text object. Or, take the path, grab the list from the path, grab the last item in the list, and that will be the child you need to use in this path (0,0, [child], True).
The second options is really easy. Just grab the -1 index from the 2nd index of the item path. In other words [ item['Path'][2][-1] ].
Code: Select all
RelativePath = (0, 0, [ item['Path'][2][-1] ], True)
2) As far as I know, you're not doing anything "wrong" it just doesn't work with scripts if your text is wrapped using a selection.
If you record yourself editing a text object, and then play back the recorded script you'll see it shows the same bug. So while it does work in the interface, it doesn't work in scripting.
But, if you have a vector path, and you set that path as the PathTarget (also a relative path), then scripts work just fine. The problem there being that ReturnVectorProperties doesn't tell you what path you're connected to if you're using text wrapping.