The thread-safety problem you are experiencing is not really related
to the scripting as such but to the threading model WinForms/WPF is
using.
I have prepared a straight forward example for you that demonstrates
how to deal with the problem. Note the "fix" is not in the script but
in the application you are trying to automate. This is where tha
marshaling needs to be done.
You can find the sample here:
http://dl.dropbox.com/u/2192462/Support/Automation.7z
Cheers,
Oleg