I'm building a script intended to take one or more GREP styles from a single paragraph style in a source document and add them to a chosen paragraph style in a destination document.
My problem, at this point, is that if the destination doc does not have a character style with the name of the applied character style of the incoming GREP style, that I have not found a successful way to import that character style (just that one, not all char styles) into the destination doc. Two unsuccessful tries are in the last else block of the code sample, repeated here:
duplicate vCurrentSourceGrepRef to end of vDestDoc --NOPE
tell vDestDoc to set vDestAppliedCharStyle to (make new character style at end with properties (properties of applied character style ofvCurrentSourceGrepRef)) --NOPE
I know that import style is a possibility, but I don't know how to limit the styles to just one.
Another laborious possibility is to make a new style and set all properties individually, avoiding problem properties that refer back to the source doc, but that's error-prone with an object with lots of properties that might be important.
Another possibility might be to build a temp element in the source doc containing the applied character style, and cut it, then paste it into the destination doc, and then delete it. But that seems hackish.
What's the best way to approach this kind of thing?