Keyframe Assistants require the property to be converted selected and that only works with open comps, naturally. Generally you would not use this feature, anyway, but rather use valueAtTime() in your script to get the actual value and bake it into a keyframe. Pretty much how most scripts of that ilk work in the first place.
Thanks for your reaction, Mylenium. The strange thing is that the properties ARE selected by the script even when the comps aren't open, but indeed the Keyframe assistant cannot complete its task.
So let's take a look at your suggestion, using valueAtTime. That would give me the expression-generated value of a layer? Or rather the original value? If the first is true, okay, good idea, but how do I bake this value into let's say a position keyframe? And how do I eliminate the expression? Because that is the main target: the expressions I use generate a position based on a sampleImage() of another layer. This sampling is very time consuming, though the position is just one static value, because AE keeps sampling for the entire comp's duration. So what I want to do is to determine this sampleImage value just once and bake that value in the position parameter of another layer.
Now I noticed that sampleImage() unfortunately is not a script command, just for expressions apparently. If however, I could use valueAtTime to get the sampleImage value generated by the expression on let's say time zero, I can enter that value into the position parameter of another layer through scripting, but then I would also need a command that disables or destroys the expressions.
Now I don't know if that is possible.