in your code, what is 'Manuscript Draft'? Well, actually, I know what Nisus thinks it is. Nisus thinks it's a text object containing the text string 'Manuscript Draft' and having whatever attributes are present in your macro file. So for example, if your macro code has a paragraph style 'macro code' applied to that line, your code will import the paragraph style 'macro code' into $doc (and replace any pre-existing style with the same name). That is not what you are looking for, I believe.
Rather, let's assume you have a document open called 'Manuscript Draft.rtf' and you want to import its styles into $doc, you should do something like this:
Code: Select all
$doc = Document.active
$styleDoc = Document.withDisplayName 'Manuscript Draft.rtf'
$doc.addStyles $styleDoc.text, 'replace'
Obviously the code for retrieving the document with the styles may need some adjustment depending on your case (e.g., getting a document from a file path, or the style library, etc.)
Anyhow the important point is that the '.addStyles' command requires that first argument to be a text object. If you enclose that argument in quotes, then it is a literal, i.e., the text in the command is itself the text object. Hope that is clear.